[fpc-devel] About bug 4928

Tomas Hajny XHajT03 at mbox.vol.cz
Fri Mar 31 13:02:29 CEST 2006


Maxim Ganetsky wrote:


> There is another bug (bug 4928) about charsets and Crt was added to
> bugtracker recently:
>
> "Simply include "uses crt;" and your write() output is garbled.
> I use Russian language, win32, codepage 1251. Some symbols are
> substituted by question marks, some --- by other symbols.
> CRT docs don't mention it openly, some other unfixed bugs don't seem to
> state this exact problem."
>
> I can add that in this case these problems can be solved by adding to
> the program
>
>   SetConsoleCP(1251);
>   SetConsoleOutputCP(1251);
 .
 .
> It would be good to add a trick like this to win32 crt (i.e. set Windows
> default charset for console) as it would ease porting of old TP programs
> to FPC.

I'm afraid it's slightly more complicated than this. Older Windows
versions (Win9x, WinNT 4.0) use different default codepage (charset) for
console windows and for GUI ("OEM" versus "ANSI" codepages). Newer
versions (Win2k+) use always the "ANSI" codepages (i.e. 1251 for Russian,
1250 for Central Europe, 1252 for Western Europe). No idea what WinME
does. Anyway, you have to check the Windows version first...

Tomas




More information about the fpc-devel mailing list