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

Fix handling of emoji (high-plane Unicode) #17

Open
erkyrath opened this issue Mar 24, 2016 · 2 comments
Open

Fix handling of emoji (high-plane Unicode) #17

erkyrath opened this issue Mar 24, 2016 · 2 comments

Comments

@erkyrath
Copy link
Owner

Comment from glkapi.js:

Some places in the library get confused about Unicode characters beyond 0xFFFF. They are handled correctly by streams, but grid windows will think they occupy two characters rather than one, which will throw off the grid spacing.

Also, the glk_put_jstring() function can't handle them at all. Quixe printing operations that funnel through glk_put_jstring() -- meaning, most native string printing -- will break up three-byte characters into a UTF-16-encoded pair of two-byte characters. This will come out okay in a buffer window, but it will again mess up grid windows, and will also double the write-count in a stream.

@curiousdannii
Copy link
Contributor

https://mathiasbynens.be/notes/javascript-unicode#accounting-for-astral-symbols

Assuming you can't move to ES6 yet, using punycode.js is probably your safest and easiest option. The minified version is only 2.74kb.

@erkyrath
Copy link
Owner Author

Thanks.

I should probably flip the grid-window handling over to work on int arrays, which will solve that problem. glk_put_jstring is the messy case.

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