On Mon, 16 Jul 2007, Felipe Monteiro de Carvalho wrote:
> Hi,
>
> I was studying more about the unicode support, and I compiled my lcl
> for the partial unicode support available and tryed to run one form
> with 1 button, 1 label and 1 edit, with this code:
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
> MyStr: UTF8String;
> begin
> MyStr := 'Accents á, é, í, ó, ú Polsko: ć, ę, ł, ś, ź, ż';
> // Label1.Font.Name := 'Times New Roman';
> Label1.Caption := MyStr;
> Edit1.Text := MyStr;
> Button1.Caption := MyStr;
> end;
>
> UTF-8 encoded obviously
>
> But, the accented words are not shown. They appear as empty spaces. I
> tryed without setting anything on the font, with arial, with times new
> roman. My current guess is that the font doesn't support those
> characters, but it would be quite wierd if the standard font doesn't.
>
> The implementation of SetText for win32 seams ok for me:
>
> class procedure TWin32WSWinControl.SetText(const AWinControl:
> TWinControl; const AText: string);
> Begin
> if not WSCheckHandleAllocated(AWincontrol, 'SetText')
> then Exit;
> {$ifdef WindowsUnicodeSupport}
> if UnicodeEnabledOS
> then Windows.SetWindowTextW(AWinControl.Handle, PWideChar(Utf8Decode(AText)))
> else Windows.SetWindowText(AWinControl.Handle, PChar(Utf8ToAnsi(AText)));
> {$else}
> Windows.SetWindowText(AWinControl.Handle, PChar(AText));
> {$endif}
> End;
>
> Any ideas?
I think the Label.Caption string is an Ansistring ? Then it will already have
the special characters
stripped at the point where you set
Label1.Caption := MyStr;
So the special characters are not even passed to SetText ?
Michael.