[haXe] Exchanging Unicode strings via remoting

Nicolas Cannasse ncannasse at motion-twin.com
Wed Aug 9 17:38:12 CEST 2006


Michael Pliskin wrote:
> Hello list,
> 
>   I've found that the current serialization engine does not seem to
>   work correctly with non-ASCII strings. Consider the attached example
>   - we're sending a non-ASCII (cyrillic in fact) value from flash to
>   neko and expecting to get the valid result, but getting an exception
>   instead. I have a feeling that this occurs because Flash send
>   Unicode data, while neko expects UTF-8, but have no idea what's the
>   best way to deal with this. The problem is pretty critical for me as
>   I have to process non-ASCII user input on Flash side...

Flash strings are UTF-8.

You can check that the strings on the client are correctly encoded at
compilation-time by trace'ing them. They should display correctly (as
soon as the default font is capable of displaying the utf chars). If
not, then try setting your editor/IDE so you can edit in UTF8-mode. If a
correct UTF-8 string is given to the haxe compiler, it will leave it
as-it in the generated SWF.

Neko strings are byte-buffers, with an UTF8 API (the neko.Utf8 module).
haXe remoting currently transfers only UTF8 strings. Your example should
work fine since adding two byte buffers and adding two UTF8 strings
should provide the same result.

Nicolas



More information about the Haxe mailing list