[fpc-pascal] Default source encoding

Michael Van Canneyt michael at freepascal.org
Thu Mar 31 14:41:30 CEST 2016



On Thu, 31 Mar 2016, Mattias Gaertner wrote:

> On Thu, 31 Mar 2016 14:14:14 +0200 (CEST)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>
>> [...]
>> > What happens on a Russian system cp1251 with a cp1251 AnsiString
>> > literal?
>> >
>> > writeln('Привет');
>> 
>> Careful, writing may change the codepage.
>
> Yes, I know. That's why it is important that the compiler uses the
> right conversion (CP1251 Win Cyrillic to CP866 DOS Cyrillic).

It depends on what the console codepage is set to.

Line 2657 of text.inc:

TextRec(f).CodePage:=WideStringManager.GetStandardCodePageProc(scpConsoleOutput);

>
> If the compiler assumes CP1252 on a CP1251 system, then the writeln
> should write garbage. Correct?

Not if the above assumption is correct.

But I'm just a student in this, Jonas is the Master who should be obeyed in such matters ;)

Michael.


More information about the fpc-pascal mailing list