Are those parts of the previous character? -- brion
On May 11, 2017 10:24 AM, "Giovanni P" <[email protected]> wrote: > I tried to decode these 3 bytes in many ways, but couldn't find any way to > make sense of them. As you say, these are not exactly the bytes for an > UTF8-encoded "á". The program I'm compiling does say in its documentation > (I didn't write it, and I don't quite understand its source code) that it > outputs utf8, so maybe something is getting wrong inside the program -- but > only when unicode is being passed --, how can I possibly fix it? > > Do you know what -17, -65, -67 mean? Maybe it has some meaning I'm not > aware of, maybe that meaning will give me a hint of what is going wrong. > > Thank you very much. > > On Wed, May 10, 2017 at 7:10 PM, Brion Vibber <[email protected]> wrote: > >> 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 a topic in the >> Google Groups "emscripten-discuss" group. >> To unsubscribe from this topic, visit https://groups.google.com/d/to >> pic/emscripten-discuss/h09tleb6YX8/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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. > -- 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.
