[Lazarus] Debugging fixed strings in UTF8 encoding

Ernest V Miller miller_ev at etk.ru
Wed Mar 27 05:08:08 CET 2013


Hello!

As we know, Lazarus is UTF8 friendly. When I want to see a value of a
string var in cyrillic, I should convert it to UTF8, else I only get
"?????????" in Watches window.
For this code

 function TesterClass.quickTest : Boolean;
    var
      utf8, ansi : string;
      stf : string[50];
    begin
       ansi := Utf8ToAnsi('Кукла');
       utf8 := AnsiToUtf8(ansi);
       <....>
    end;

I see value of utf8 in russian. And I am absolutely happy. But as soon as I
want to use fixed strings, the only way for me to see my native language
when debugging is to declare an additional string var as you can see below:

function TesterClass.quickTest : Boolean;
    var
      utf8, ansi : string;
      stf : string[50];
    begin
       ansi := Utf8ToAnsi('Кукла');
       utf8 := AnsiToUtf8(ansi);
       stf := AnsiToUtf8(ansi);   // here I get
"#208#154#209#131#208#186#208#187#208#176" in Watches for stf
       utf8 := stf;                    //but here I see my grandfather's
language again
       <....>
    end;

I consider having a special string var for debugging russian is completely
stupid. Maybe I don't know some GDB tweak to force it to recognize the
characters of my ancestry in fixed strings?

--------------------
Regards,
      Ernest Miller


More information about the Lazarus mailing list