Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji support #90

Open
LukeTOBrien opened this issue Jul 24, 2020 · 3 comments
Open

Emoji support #90

LukeTOBrien opened this issue Jul 24, 2020 · 3 comments

Comments

@LukeTOBrien
Copy link

LukeTOBrien commented Jul 24, 2020

Hello there,

I've noticed an issue with Emoji, some Emoji are two charecters or more, upon applying lettering the characters are split and the Emoji no longer displays, instead you get the default broken charecter.
If I get time I will create an example oon codePen, but I think you get the idea.

Thanks

Luke

@davatron5000
Copy link
Owner

This is maybe tough to support because more modern emoji are actually combinations of multiple emojis but with with zero-width joiners.

// pseudo code
"👩‍🚀".split() // ["👩‍", "", "🚀"]

If you have time to make a CodePen, I can poke at it some.

@LukeTOBrien
Copy link
Author

Could we use some fancy regex patten to avoid splitting the emoji?
https://stackoverflow.com/questions/47274478/how-to-exclude-escaped-characters-in-split-javascript

I will try to get some time to do this.

@LukeTOBrien
Copy link
Author

LukeTOBrien commented Jul 25, 2020

I have created a Pen that looks promising.
If you do inspect element on the output you will see - I am using match instead of split.

Split

"Hello 🐒".split('')

Array(8) [ "H", "e", "l", "l", "o", " ", "\ud83d", "\udc12" ]

Match

"Hello 🐒".match(/(\w)|([^\u0000-\u007F]+)/g)

Array(6) [ "H", "e", "l", "l", "o", "🐒" ]

"Hello 👩•🚀".match(/(\w)|([^\u0000-\u007F]+)/g)

Array(6) [ "H", "e", "l", "l", "o", "👩‍🚀" ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants