-
Notifications
You must be signed in to change notification settings - Fork 66
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
Inconvenient emoji ascii replacement #96
Comments
To solve my user case I updated the asciiRegex to:
I basically added This forces the regex to make a emoji substitution only when the ascii match is separated by a whitespace or start/end of line |
Hey @felpsio, react-emoji-render/src/aliasRegex.js Lines 7 to 15 in e959d6d
In the same way we have |
hey @enzoferey, but this can help on many other cases. For example, instead of chrome: So it's probably safer require a whitespace or start/end of line to avoid all these cases. Still going to work on these cases: |
Right, the design decisions for this library was to support emojis without required whitespaces, hence going for this solution. I'm happy to add as many edge cases as needed. Note that you can always escape certain parts of a string, transform the rest of the string with this library, and then concatenate back. |
Thanks @enzoferey. You're right. My use case may not suit the goal of this lib. So for now, I'll probably keep my forked version and bring the updates from the main version manually as they update. But I suggest then adding these edge cases: Feel free to close my issue then :). If somebody else needs to add |
As you prefer @felpsio, happy to accept PRs for such edge cases 👍🏻 |
Hi @felpsio, I encountered an issue really close to this one so i didn't feel like opening a new issue was necessary. But, if i have "Https" instead of "https", it will, so "Https://somexample.com/issues/96" becomes "Https😕/somexample.com/issues/96". So, the case should not matter when checking if it's an exception or not. |
@nicolasvidelac maybe for your case you can just transform the string in lower case. |
The regex that identifies ascii emojis and replaces them by the actual emojis should check for whitespace before and after the match. Or it may add inconvenient emojis in some cases. Example:
"chrome://settings/content/notifications"
is translated to"chrome😕/settings/content/notifications"
Suggestion:
only apply the ascii conversion when:
The text was updated successfully, but these errors were encountered: