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

Tomas Hajny XHajT03 at hajny.biz
Tue Jul 9 11:59:45 CEST 2013


On Tue, July 9, 2013 11:13, Jonas Maebe wrote:
> On 09 Jul 2013, at 11:02, Noah Silva wrote:
 .
 .
>> 3. Is there a way to set the output to UTF8 so I can just write out
>> UTF8
>> and be done with it?
>
> I don't know.

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.

Tomas





More information about the fpc-pascal mailing list