<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Mattias Gaertner via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Di., 8. Sep. 2020, 22:32:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, 8 Sep 2020 20:27:20 +0200<br>
Jonas Maebe via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-pascal@lists.freepascal.org</a>> wrote:<br>
<br>
> On 07/09/2020 08:51, LacaK via fpc-pascal wrote:<br>
> <br>
> > attached simple Lazarus compilable project (one Form).<br>
> > <br>
> > ...<br>
> > type<br>
> >   String1250 = type AnsiString(1250);<br>
> > <br>
> > const<br>
> >   c2: AnsiString = 'áéíóčž';<br>
> >   c3: WideString = 'áéíóčž';<br>
> >   c4: String1250 = 'áéíóčž';<br>
> > <br>
> > { TForm1 }<br>
> > <br>
> > procedure TForm1.FormShow(Sender: TObject);<br>
> > begin<br>
> >   label1.Caption:='áéíóčž'; // FAIL<br>
> >   label2.Caption:=c2;       // FAIL<br>
<br>
label2.Caption:='a'+c2; // OK<br>
<br>
> >   label3.Caption:=c3;       // OK<br>
> >   label4.Caption:=c4;       // FAIL<br>
> > end;  <br>
<br>
Reason is that LCL TLabel.Caption expects UTF-8.<br>
You can use <br>
<br>
label2.Caption:=WinCPToUTF8(c2); // from unit LazUTF8<br>
<br>
Maybe SetCaption could check if passed string is not CP_ACP and do a<br>
conversion.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Why does c4 fail however? Shouldn't the compiler insert a type conversion from codepage 1250 to CP_ACP which is UTF-8 in Lazarus? </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>