Some problem with a Widestring lazarus / 12-Debugger ---------------------------------------------------------------------- crazyfroggy · 2012-06-11 13:44 Hi, I have a Texte : Widestring at debuging, I get those values, which I don't understand : Integer(Texte[1]) = 1488 WideChar(Texte[1]) = 1468 #188 I should get a char, with the 2nd variable, I get an integer and something ?? Integer(Texte[2]) = 1468 WideChar(Texte[2]) = 1456 #176 Integer(Texte[3]) = 1456 WideChar(Texte[3]) = 47 '/' Integer(Texte[4]) = 47 WideChar(Texte[4]) = 1512 #232 ... So I guess that  the value in decimal = #XXX, but I don't understand why I don't get the Unicode Char A, B, C, ..... and only it Tx for your help ---------------------------------------------------------------------- theo · 2012-06-11 15:27 What are you trying to achieve? Lazarus uses UTF-8, not WideString (UCS-2, UTF-16). ---------------------------------------------------------------------- crazyfroggy · 2012-06-12 14:21 OK, I will take a peep about the utf-8 tips ---------------------------------------------------------------------- felipemdc · 2012-06-12 14:26 The wiki has a page explaining how to UTF-8 string: http://wiki.lazaru s.freepascal.org/LCL%20Unicode%20Support#Dealing_with_UTF8_strings_and _characters ---------------------------------------------------------------------- Martin_fr · 2012-06-12 14:52 Widechar should work. Though it is little tested. Why the extra typecast: Code: [Select]WideChar(Texte[1]) It should be enough to do: Code: [Select]Texte[1] Though I only checked with Lazarus snapshot. It is possible that it does not work in 0.9.30.4. There was much work done in the debugger. Please also note: http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Strings If you update you should also ensure that your config points to the correct gdb.exe (should be 7.3) ---------------------------------------------------------------------- crazyfroggy · 2012-06-13 10:09 Tx for your help. As I got an  odd 1468 #188, I added the extra typecast, to check what that could release, and letted it I will check the url you gave me Tx again, help is really appreciated. ---------------------------------------------------------------------- Martin_fr · 2012-06-13 11:06 Well #188 is a char (widechar) However maybe not the char you expected... Normally a char is displayed as it's ordinal value followed by it's representation (but if it is not printable then that is #...) So the ordinal value of your char is 1468. And that is probably correct. GDB does not seem to deal with widechar very good, so it messes up the #188 (as it appears, that it also can not print it). The IDE was mainly tested for utf8 (and even that is ongoing..., so the IDE does not correct the gdb result. That means all you can get is the ordinal value of that widechar. But you can not get it displayed. That applies to all versions of Lazarus and gdb. You may report that as a bug. But it will probably not get much of a priority. ---------- Note http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Strings The index is handled wrong. And that is impossible to fix. GDB does not allow to differ between pchar and string (pwidechar and widestring) pchar is 0-based, string 1 based. With strings the index is wrong by one Lazarus Snapshot will show both results (at least for string. not tested for widestring). The index problem is a known issue, it can currently not be fixed. So do not report as a bug, please.