[Lazarus] UTF8 RTL for Windows

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


2014-11-24 8:15 GMT-03:00 Mattias Gaertner <nc-gaertnma at netcologne.de>:

> On Sun, 23 Nov 2014 21:37:56 -0300
> luiz americo pereira camara <luizmed at oi.com.br> wrote:
>
> > The attached program show how data loss can occur
>
> The program uses writeln, which converts to console CP.
> When you save the strings to a file you can see what they contain. Or
> write the byte values.
>
>
Yes. I improved the program (see message that followed) to write the bytes
values so the comparison should be more exact.


> This works with or without {$codepage utf8}:
>
> S := 'João'; // constant to (Ansi or Short)string
>

Without {$codepage utf8}
When DefaultSystemCodePage is CP_ACP the variable S will have the content
of UTF8 but the encoding will be ACP (in my case 1252), just like is today.
With DefaultSystemCodePage as CP_UTF8 both content and code page will match

[..]

I guess it would be a good idea to pass -Fcutf8 with FPC 2.7.1. For
> both modes.
>
>
Probably yes.
There's one case that must be tested. When the file is encoded in ansi like
those shared with Delphi.
What i understand with -Fcutf8, the compiler will interpret those content
as UTF8 creating wrong encoded constant.

$codepage directive overrides -Fcutf8?
If so, to fix the developer could use $codepage with the correct file
encoding

Luiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141124/d8749635/attachment-0003.html>


More information about the Lazarus mailing list