kripken/emscripten — pull request #1382 by aidanhs (2013-08-18 01:24:57+00:00)
Title: Pointer_stringify fails on large unicode codepoints.

Use any emscripten runtime to try out this function to convert a string to a pointer and back (based on instructions from [here](https://github.com/kripken/emscripten/wiki/Interacting-with-code#other-methods)):
```
function emtest (str) {
return Module.Pointer_stringify(
Module.allocate(Module.intArrayFromString(str), 'i8', Module.ALLOC_STACK)
);
}
```
Which should just return the exact string it was given. Lets try it in the chromium console.
```
emtest("test") = "test"
emtest("naïve") = "naïve"
emtest("μ†ℱ ╋ℯ╳╋") = "μ†ℱ ╋ℯ╳╋"
```
Good. However, [code point 128519 fails](https://gist.github.com/aidanhs/5996985) (can't paste it in here because github issues apparently don't like chars above 0xffff).

In fairness, this character cannot be properly produced without working around the fromCharCode limitations - e.g. with the ES6 shim for [fromCodePoint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode). Perhaps this should be used? Emscripten correctly breaks it down (the values from intArrayFromString look right) so codePointAt isn't needed.