On Tue, May 9, 2017 at 8:04 PM, Giovanni Parra <[email protected]> wrote:
> I mean the stdout function configurable at FS.init: https://kripken. > github.io/emscripten-site/docs/api_reference/Filesystem- > API.html#setting-up-standard-i-o-devices > > Most times I can handle the values passed to that function by calling > String.fromCharCode(c) on them, so I get the corresponding Javascript > character, but when the C function would return a unicode character it then > passes negative numbers to stdout and the results are unexpected, > String.fromCharCode handles the negative values, but gives me meaningless > characters. > > For example, at a certain point I passed an "á" character, > "á".charCodeAt(0) == 225, and was expected to get that same "á" back, but > instead I get 3 negative numbers, -17, -65 and -67, resulting in the string > "ᄑ". > Could this be UTF-8 bytes being passed as signed chars? "á" in UTF-8 is 0xc3 0xa1, or -67 -33 -- brion -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
