[Lazarus] Debugging fixed strings in UTF8 encoding

Ernest V Miller miller_ev at etk.ru
Fri Mar 29 02:18:55 CET 2013



Martin <lazarus at mfriebe.de> написано 28.03.2013 19:58:17:

> Also in your first example
> > ansi := Utf8ToAnsi('Кукла');
> is that cyrillic? Can that be translated into ansi on your system? Have
> you tried to output the string
>
> for i := 1 to length(ansi) do s := s + inttostr(ord(ansi[i]))+', ';


      Yes, it is cyrillic and it can be translated into ansi. My value of s
after your test loop for 'Кукла' is '202, 243, 234, 235, 224, '


>
>
> There are 2 issues (in what I reproduced):
>
> 1) *** "???"
>
> Actually the "?" are really present in the string. They are put there by
> Utf8ToAnsi for characters that could not be translated to ansi. So in
> that the debugger shows the correct content.
>
> At least that happens with the chars I used for testing:

      Despite the fact that each character of 'Кукла' is represented in
ansi, Utf8ToAnsi gives ? in exchange for every normal ansi symbol.
      Interesting thing is that further call of
            AnsiToUtf8(ansi);  //ansi contains '?????' as a result of
previous Utf8ToAnsi('Кукла') conversion
      returns 'Кукла' again, not '?????'.



More information about the Lazarus mailing list