2014-11-24 8:15 GMT-03:00 Mattias Gaertner <[email protected]>:
> On Sun, 23 Nov 2014 21:37:56 -0300 > luiz americo pereira camara <[email protected]> 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
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
