[fpc-pascal] String literals and code page of .pas source file

LacaK lacak at zoznam.sk
Wed Sep 9 08:37:27 CEST 2020


>> attached simple Lazarus compilable project (one Form).
>>
>> ...
>> type
>>    String1250 = type AnsiString(1250);
>>
>> const
>>    c2: AnsiString = 'áéíóčž';
>>    c3: WideString = 'áéíóčž';
>>    c4: String1250 = 'áéíóčž';
>>
>> { TForm1 }
>>
>> procedure TForm1.FormShow(Sender: TObject);
>> begin
>>    label1.Caption:='áéíóčž'; // FAIL
>>    label2.Caption:=c2;       // FAIL
>>    label3.Caption:=c3;       // OK
>>    label4.Caption:=c4;       // FAIL
>> end;
> The attached pure FPC-variant of your project works fine with FPC 3.2.0
> for me (except for the very first writeln, because that one gets
> interpreted as "writeln(shortstring)"),

*yes for me on Windows it works also (under Lazarus 2.0.8 with FPC 3.0.4)
*

*
*

>   so it may be Lazarus-specific.
> Best ask it on the Lazarus list or post it on their bug tracker instead.

*I add CC also to Lazarusdev group
(attached simple project)
*

*
*

>
> Also make sure you did *not* build your Lazarus with -dDisableUTF8RTL

*I do not build Lazarus with -dDisableUTF8RTL (I simply use default 
installation)*

*As Sven wrote there is at least "c4" case, where declared code page 
(AnsiString(1250)) is different from AnsiString (CP_ACP) codepage and 
also from dynamic code page (DefaultSystemCodepage which is under 
Lazarus (UTF8=65001))*

*I am still confused how this CodePage aware stuff is expected to work 
and when implicit conversios are included (as far as I understand here 
ONLY declared/static codepage plays role) and when dynamic codepage is 
taken into account and when not?*

*L.*


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200909/dabe1de7/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_cp1250.ZIP
Type: application/x-zip-compressed
Size: 2703 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200909/dabe1de7/attachment.bin>


More information about the fpc-pascal mailing list