From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20487 invoked by alias); 5 Mar 2010 08:33:32 -0000 Received: (qmail 20477 invoked by uid 22791); 5 Mar 2010 08:33:31 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00,MISSING_HEADERS X-Spam-Check-By: sourceware.org Received: from wp151.webpack.hosteurope.de (HELO wp151.webpack.hosteurope.de) (80.237.132.158) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Mar 2010 08:33:25 +0000 Received: from 188-192-228-236-dynip.superkabel.de ([188.192.228.236] helo=[192.168.1.130]); authenticated by wp151.webpack.hosteurope.de running ExIM with esmtpa id 1NnSyH-0004b5-P7; Fri, 05 Mar 2010 09:33:21 +0100 Message-ID: <4B90C17B.8020001@technosis.de> Date: Fri, 05 Mar 2010 08:33:00 -0000 From: Anton Kunze User-Agent: Thunderbird 2.0.0.18 (X11/20081112) MIME-Version: 1.0 CC: gdb@sourceware.org Subject: Re: Printing of strings with special characters References: <4B8F9FE9.2040401@technosis.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00036.txt.bz2 Hello Tom, it doesn't work with charset UTF-32: here is my test code: ------------------------------------------------------- std::string strTest = "höhöhö"; const char* szTest = "höhöhö"; -------------------------------------------------------- my gdbinit: --------------------------------------------------------- set target-charset UTF-32 set target-wide-charset UTF-32 set print pretty off set print sevenbit-strings off set print object on --------------------------------------------------------- gdb console input/output: --------------------------------------------------------------------------------------------------------- show print sevenbit-strings Printing of 8-bit characters in strings as \nnn is on. // <----------this is weird set print sevenbit-strings off show print sevenbit-strings Printing of 8-bit characters in strings as \nnn is off. print strTest $2 = {static npos = 4294967295, _M_dataplus = {> ={<__gnu_cxx::new_allocator> = {}, }, _M_p = 0x935dcd4 "\150\366\150", }} print szTest $3 = 0x88db03a "\150\366\150", --------------------------------------------------------------------------------------------------------- UTF-16 doesn't work too. best regards Tom Tromey schrieb: >>>>>> >>>>>> "Anton" == Anton Kunze writes: >>>>>> >>>>>> >>>>>> > > > > Anton> i'am using gdb 7.0.1 with python and pretty printing on suse linux. If I > > Anton> try to print string with german special characters I get only strings as > > Anton> '\nnn'. > > > > Anton> My gdbinit file contains following: > > Anton> set charset ISO-8859-1 > > Anton> set target-wide-charset ISO-8859-1 > > > > This is almost certainly wrong. You probably want `set > > target-wide-charset UTF-32' -- which is the default on Linux. At least, > > that will be what you want if your code is using wchar_t. > > > > Also, I recommend against using "set charset"; use target-charset > > instead. 'set charset' sets the host charset in addition to the target > > charset, but on systems with a decent locale implementation, you > > basically will always want to use the result reported by the locale. > > > > Anton> sys.path.insert(0, '/home/anton/projects/debug/printers') > > > > Without the source to this we can't be completely sure about the > > problem. > > > > Anton> Within my debug session I use the following commonds on gdb console: > > > > Anton> set print sevenbit-strings off > > Anton> print qsHtml > > Anton> $4 = "h\366h\366h\366" > > > > What type is a qsHtml? Specifically, what is the underlying character > > type it uses? > > > > Tom > > > > > > > Tom Tromey schrieb: >>>>>> "Anton" == Anton Kunze writes: >>>>>> > > Anton> i'am using gdb 7.0.1 with python and pretty printing on suse linux. If I > Anton> try to print string with german special characters I get only strings as > Anton> '\nnn'. > > Anton> My gdbinit file contains following: > Anton> set charset ISO-8859-1 > Anton> set target-wide-charset ISO-8859-1 > > This is almost certainly wrong. You probably want `set > target-wide-charset UTF-32' -- which is the default on Linux. At least, > that will be what you want if your code is using wchar_t. > > Also, I recommend against using "set charset"; use target-charset > instead. 'set charset' sets the host charset in addition to the target > charset, but on systems with a decent locale implementation, you > basically will always want to use the result reported by the locale. > > Anton> sys.path.insert(0, '/home/anton/projects/debug/printers') > > Without the source to this we can't be completely sure about the > problem. > > Anton> Within my debug session I use the following commonds on gdb console: > > Anton> set print sevenbit-strings off > Anton> print qsHtml > Anton> $4 = "h\366h\366h\366" > > What type is a qsHtml? Specifically, what is the underlying character > type it uses? > > Tom > > >