[fpc-pascal] FPC 3: disabling automatic AnsiString codepage conversion

Michael Van Canneyt michael at freepascal.org
Mon Apr 4 11:35:53 CEST 2016



On Mon, 4 Apr 2016, Mattias Gaertner wrote:

> On Mon, 4 Apr 2016 10:32:58 +0200 (CEST)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>
>> [...]
>> You cannot, but you can set DefaultSystemCodePage to CP_UTF8.
>
> I think it is important to note how to do this properly:
>
>  SetMultiByteConversionCodePage(CP_UTF8);
>  SetMultiByteRTLFileSystemCodePage(CP_UTF8);
>
> You should add these lines in an early initialization section. The
> beginning of your program might be too late.
>
>> Then no conversions will be done for all ansistrings that contain UTF8.
>
> And this really means AnsiString, not AnsiString(something).

The latter cannot contain UTF8 unless you do some really nasty tricks... :-)

Michael



More information about the fpc-pascal mailing list