[Lazarus] WinCE and strings

Antonio Fortuny a.fortuny at sitasoftware.lu
Tue Jul 10 13:16:02 CEST 2012

I have made a little test. One function

LabelInfo is a TLabel.

procedure TfMenu.BtnTestClick(Sender: TObject);
   Msg1: string;
   Msg2: AnsiString;
   Msg2a: AnsiString;
   Msg3: WideString;
   Msg1 := 'Texte message'+#13#10+'çàéioù';
   LabelInfo.Caption := Msg1;
   MessageDlg('String', Msg1, mtError, [mbOK], 0, mbOK);
   Msg2 := SysToUTF8('Texte message'+#13#10+'çàéioù');
   LabelInfo.Caption := Msg2;          <-------------------------- shows 
funny chars
   MessageDlg('UTF8',Msg2, mtError, [mbOK], 0, mbOK); 
<-------------------------- shows funny chars
   Msg2a := AnsiToUtf8('Texte message'+#13#10+'çàéioù');
   LabelInfo.Caption := Msg2a; <-------------------------- shows funny chars
   MessageDlg('UTF8a',Msg2a, mtError, [mbOK], 0, mbOK); 
<-------------------------- shows funny chars
   Msg3 := UnicodeString('Texte message'+#13#10+'çàéioù');
   LabelInfo.Caption := Msg3;
   MessageDlg('Unicode',Msg3, mtError, [mbOK], 0, mbOK);

When using UTF8 conversion, displayed texts are rubbish. All other 
display OK on two lines. These results leave me a little bit confused
Same results (rubbish with UTF8, WideString not generated) when compiled 
and run on Win32


More information about the Lazarus mailing list