Unicode字符串问题

问题描述:

我在char数组中存储了一些unicode字符“лфи”。 当我观看(X/30秒)在gdb值它告诉我是这样的:Unicode字符串问题

0x80ac47c: 0x80ac482 “\ 004> \ 004?”:“A \ 0048 \ 004; \ 004L \ 004D \ 004> \ 004 = \ 004:\ 0045 \ 004 /“

为什么发生这种情况,这些\ 004代表什么?

+0

使用'x/hs addr'命令,请参考以下链接:[http://reverseengineering.stackexchange.com/questions/1860/printing-unicode-strings-in-gdb-in-osx](http: //reverseengineering.stackexchange.com/questions/1860/printing-unicode-strings-in-gdb-in-osx)。 – 2014-11-25 02:56:34

你应该阅读gdb's character set documentation,因为看起来gdb正在转义这些字符,而不是让终端显示它们。

+0

谢谢,我会检查。 – RKum 2013-03-27 10:51:54

请参阅Gdb Unicode Printing。如果你在你的代码中重载dbg_dump函数,通过在gdb中调用print dbg_dump("лфи")它将有望调用你的重载函数,从而产生正确的UTF-8表示。请记住,在您的帐户dbg_dump中,您可能需要明确表示要显示Unicode字符。

+0

谢谢,我会检查。 – RKum 2013-03-27 10:52:32