<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-11-24 8:15 GMT-03:00 Mattias Gaertner <span dir="ltr"><<a href="mailto:nc-gaertnma@netcologne.de" target="_blank">nc-gaertnma@netcologne.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">On Sun, 23 Nov 2014 21:37:56 -0300<br>
luiz americo pereira camara <<a href="mailto:luizmed@oi.com.br">luizmed@oi.com.br</a>> wrote:<br>
</span><span class=""><br>
> The attached program show how data loss can occur<br>
<br>
</span>The program uses writeln, which converts to console CP.<br>
When you save the strings to a file you can see what they contain. Or<br>
write the byte values.<br>
<br></blockquote><div><br></div><div>Yes. I improved the program (see message that followed) to write the bytes values so the comparison should be more exact.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
This works with or without {$codepage utf8}:<br>
<br>
S := 'João'; // constant to (Ansi or Short)string<br></blockquote><div><br>Without {$codepage utf8}<br></div><div>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.<br>With DefaultSystemCodePage as CP_UTF8 both content and code page will match<br></div><div><br>[..] <br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I guess it would be a good idea to pass -Fcutf8 with FPC 2.7.1. For<br>
both modes.<br>
<div class=""><div class="h5"><br></div></div></blockquote><div><br></div><div>Probably yes. <br></div><div>There's one case that must be tested. When the file is encoded in ansi like those shared with Delphi.<br></div><div>What i understand with -Fcutf8, the compiler will interpret those content as UTF8 creating wrong encoded constant.<br><br></div>$codepage directive overrides -Fcutf8?<br></div><div class="gmail_quote">If so, to fix the developer could use $codepage with the correct file encoding<br><br></div><div class="gmail_quote">Luiz<br></div></div></div>