[Lazarus] UTF8 RTL for Windows

luiz americo pereira camara luizmed at oi.com.br
Mon Nov 24 03:19:16 CET 2014


I updated the test app to show the hexadecimal representation of the string.

When {$codepage utf8} is set, all string encoding and content is right
matching each other regardless of MultiByteConversionCodePage

Without {$codepage utf8}:

When MultiByteConversionCodePage is CP_ACP (default) one string gets the
UTF8 content but code page is system ansi (1252 in my case)
When MultiByteConversionCodePage is UTF8 and two strings (converted from
WideString) get code page UTF8 but content is wrong

Luiz


2014-11-23 22:06 GMT-03:00 luiz americo pereira camara <luizmed at oi.com.br>:

> I added {.$codepage utf8} and all strings output as "Joao".
>
> Got confused. I did not to expect changes in the constant assigned to the
> UnicodeString variable
>
> Need to check what is the correct UTF8 output:  "JoA£o" or "Joao"
>
> Luiz
>
> 2014-11-23 21:37 GMT-03:00 luiz americo pereira camara <luizmed at oi.com.br>
> :
>
>
>>
>> 2014-11-20 13:21 GMT-03:00 Mattias Gaertner <nc-gaertnma at netcologne.de>:
>>
>>>
>>> Please test and tell what you find out.
>>>
>>
>>
>> Without {$codepage utf8} directive String constants will get Code Page 0
>> (CP_ACP) and not the 1200 (UTF16 - UnicodeString).
>>
>> String variables assigned to those constants will also have Code Page = 0
>>
>> This is because the constant string code page is evaluated at compile time
>>
>> Not sure if there's a compiler command line param with same effect as
>> {$codepage utf8}
>>
>> The attached program show how data loss can occur
>>
>> Luiz
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141123/c8c02198/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testStringConstantCP.lpr
Type: text/x-pascal
Size: 1008 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141123/c8c02198/attachment-0001.p>


More information about the Lazarus mailing list