[fpc-pascal] String literals and code page of .pas source file
    LacaK 
    lacak at zoznam.sk
       
    Wed Sep  9 13:51:36 CEST 2020
    
    
  
>
> > This is a bit counter intuitive to me.
>
> It is explained here:
> https://wiki.freepascal.org/Unicode_Support_in_Lazarus
>
IMO "c4" case (c4: String1250 = 'áéíóčž';) is not fully explained. 
Probably what here happens is, that declared code page of c4 = source 
file code page and in that case compiler does not insert conversion 
code. StringCodePage(c4)=1250 (also StringCodePage(c2)=1250) so dynamic 
code page is right, but when assigning to TLabel.Caption current dynamic 
code page is not taken into account
> For LacaK I recommend using UTF-8 encoding as much as possible. Then 
> everything "/just works/".
yes I use this, but I have "one" specific case where I want share one 
file between Delphi7 and Lazarus
> You could have a unit or .inc file with WinCP constants for Delphi7, 
> and then some IFDEFs. They should be explicitly converted to UTF-8 for 
> LCL.
> UnicodeString constants can also be a good solution. It triggers an 
> automatic conversion when assigned to a String variable. The 
> conversion is usually fast enough.
Yes this is what I use (WideString constants) and it is only solution 
which works for me in Delphi7/Lazarus
Thanks
L.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200909/71a97ec2/attachment.htm>
    
    
More information about the fpc-pascal
mailing list