[fpc-pascal] JSON and UTF8

Luiz Americo Pereira Camara luizmed at oi.com.br
Wed Jul 11 11:29:13 CEST 2012


Em 10/7/2012 23:19, waldo kitty escreveu:
> On 7/10/2012 07:00, Luiz Americo Pereira Camara wrote:
>> With the old behavior, in an system with a system code page <> UTF8, 
>> if i try to
>> show the parsed value of "\u4E01" in e.g. a LCL app will get garbage.
>>
>> I would expect to work correctly in any enviroment
>
> this means that some environments will end up with "garbage" for those 
> UTF-8 characters that cannot be translated back to the local 
> codepage... i've been running headlong into this with another project 
> and needing to convert from UTF-8 back to at least CP437... there are 
> more than 255 characters in UTF-8 and there's no way i know of to 
> translate them all back to 255 characters... even with trying to use 
> multiples like ae for æ ( alt-145 in CP437 i think realizing that this 
> editor can do whatever it wants to :/ )... the doublet and the 
> character i typed the ones i was thinking of for this example, though...

In the previous behavior (conversion UTF16 -> system code page) you will 
get a meaningless "character" anyway, i.e., those unicode characters are 
not correctly translated to the system code page correctly since is 
impossible.

BTW: the original issue is already fixed. Thanks Michael

Luiz




More information about the fpc-pascal mailing list