[fpc-pascal] Console Encoding in Windows (Local VS. UTF8)

Noah Silva shiruba at galapagossoftware.com
Mon Jul 29 08:01:25 CEST 2013


Hi,

2013/7/9 Jonas Maebe <jonas.maebe at elis.ugent.be>

>
> The console code page. You can get it using the following function:
>   function GetConsoleOutputCP : UINT; stdcall; external 'kernel32' name
> 'GetConsoleOutputCP';
>
>  2. Is there any reason why writing out data in the local encoding (with
>> write statements, etc.) should get corrupted?  For example is some level
>> of
>> the RTL assuming something about the encoding? (I don't think so, but...)
>>
>
> Not in 2.6.x. In 2.7.x, every ansistring is tagged with a code page (the
> ansi code page by default) and the RTL will convert it to the console code
> page before writing it.
>
>
> Oddly enough, I can get my (2.6.1) version to change the garbage it shows
but but saving the file as UTF8 with BOM.  (Until now, I had been using
UTF8 w/o BOM).

http://wiki.freepascal.org/LCL_Unicode_Support/ja

And the garbage it shows is the same garbage I see if I convert from UTF8
to ANSI manually using UTF8toAnsi or UTF8ToSys.

Detecting the Unicode BOM or not seems to be a strange way to switch the
behavior of the compiler, I wonder why a $define wasn't used instead.
 (Looking at the difference in handling, the BOM way seems much more
convenient, so I will convert things over to that...)

Jonas
>

Thank you,
    Noah Silva

> ______________________________**_________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130729/344a336c/attachment.html>


More information about the fpc-pascal mailing list