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

Noah Silva shiruba at galapagossoftware.com
Mon Jul 29 04:39:25 CEST 2013

Hello everyone,

OK I have checked this out:
2013/7/9 Tomas Hajny <XHajT03 at hajny.biz>

> There is code page 65001 for UTF-8, however I don't know since which
> version of MS Windows it is supported (and to which extent - e.g.
> including the console output). You may change the output code page for
> console using the Windows API call SetConsoleOutputCP, but e.g. our unit
> Crt currently resets the code page used for output to console to the
> "main" process code page (as returned by GetACP) on each write and thus
> ignores the user selection - this will probably change in trunk in the
> future as part of the Unicode support activities, but the current state is
> like this.
According to MSDN, GetACP returns ANSI code page (i.e. never Unicode pages
On my system, the codepage it returns is 932 (SJIS), so writing SJIS to the
console should be no issue, even is writeln resets the code page every


Yet, doing the following yields garbage:

(and I have verified that the Text field content is indeed in UTF8 format).

As for my FPC version:
Lazarus 1.1
FPC 2.6.1
SVN 37432

(I have various other versions installed, but all on OS X machines...)

>  thank you,
     Noah Silva

> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> 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/f093c531/attachment.html>

More information about the fpc-pascal mailing list