This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
UTF-8 not working for MI?
- From: Marc Khouzam <marc dot khouzam at ericsson dot com>
- To: "'gdb at sourceware dot org'" <gdb at sourceware dot org>
- Date: Thu, 19 Aug 2010 13:25:25 -0400
- Subject: UTF-8 not working for MI?
Hi,
I've noticed that in MI mode, gdb does not show UTF-8 characters properly.
Please see short session comparaison below.
Surprisingly, I get proper output when using an MI command from CLI mode.
Is there a setting I'm supposed to turn on when using MI mode? or is this
a bug? If it is a bug, I can open a PR.
Thanks
Marc
Program
1 wchar_t a = 0xe4; // ä
2 int main()
3 {
4 return 0;
5 }
> gdb -nx a.out
GNU gdb (GDB) 7.2.50.20100816-cvs
(gdb) p a
$1 = 228 L'ä'
(gdb) interpreter-exec mi "-var-create - * a"
^done,name="var1",numchild="0",value="228 L'ä'",type="wchar_t",has_more="0"
(gdb) show charset
The host character set is "auto; currently UTF-8".
The target character set is "auto; currently UTF-8".
The target wide character set is "auto; currently UTF-32".
=====
> gdb -i mi -nx a.out
=thread-group-added,id="i1"
~"GNU gdb (GDB) 7.2.50.20100816-cvs\n"
(gdb) -gdb-show charset
^done,value="auto"
(gdb) p a
&"p a\n"
~"$1 = 228 L'\303\244'"
~"\n"
^done
(gdb) -var-create - * a
^done,name="var1",numchild="0",value="228 L'\303\244'",type="wchar_t",has_more="0"
(gdb) show charset
&"show charset \n"
~"The host character set is \"auto; currently UTF-8\".\n"
~"The target character set is \"auto; currently UTF-8\".\n"
~"The target wide character set is \"auto; currently UTF-32\".\n"
^done