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

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Jul 30 12:45:25 CEST 2013


On 30 Jul 2013, at 12:04, Noah Silva wrote:

>> It causes the compiler to interpret the string constants in your  
>> program
>> as UTF-8 rather than as unknown binary data, and hence convert them  
>> at run
>> time to the current ansi code page when assigning them to an
>> ansistring/shortstring. This is unrelated to mode switches.
>
> Ooh, this clears up a lot that the Wiki didn't explain very well!

You may want to adapt the wiki in that case. It is mostly written by  
users for users. We only maintain a few pages on the wiki ourselves  
(such as User_Changes_Trunk).

> So basically saving the file with BOM tells the compiler/RTL to take  
> care
> of things for you, and saving as UTF8 without BOM is appropriate if  
> you
> will take care of any conversions yourself.

Yes.

> If UTF8String is just an alias to ANSIString,

It is, in 2.6.x.

> then I assume it also means
> that right now the compiler would convert such constants to the local
> encoding even when assigning to a UTF8String?  (If so, this explains  
> why my
> finally working console code works only with No BOM).

Indeed.

> Also, I assume that the treatment of ResourceString and any other  
> constants
> is the same?

Yes.


Jonas



More information about the fpc-pascal mailing list