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

iOS: Fix broken emojis #439

Merged
merged 2 commits into from Aug 30, 2017
Merged

iOS: Fix broken emojis #439

merged 2 commits into from Aug 30, 2017

Conversation

@javan
Copy link
Member

@javan javan commented Aug 28, 2017

  • Fixes that typing an emoji on iOS could result in a broken U+F44F: INVALID CHARACTER
  • Adds support for determining keypress event input from the event.key property when available and support for handling event.keyCodes > 65535

The root of the problem was the use of String.fromCharCode for handling event.keyCode. When you type a "πŸ‘πŸ»", for example, on iOS Safari you get a keypress event (TIL!) with an event.keyCode of 128079. The maximum value String.fromCharCode accepts is 65535 (216 - 1), and passing a larger value results in an incorrect string value:

> string = String.fromCharCode(128079)
''

> string.length
1

> string.codePointAt(0)
62543

> string.codePointAt(0).toString(16)
'f44f'

Before πŸ™…β€β™‚οΈ After πŸ™†β€β™‚οΈ
ios-before ios-after
javan added 2 commits Aug 28, 2017
@javan javan merged commit 6a234c1 into master Aug 30, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@javan javan deleted the ios/fix-emoji-input branch Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.