From: Anton Kunze <ak@technosis.de>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb@sourceware.org
Subject: Re: Printing of strings with special characters
Date: Tue, 09 Mar 2010 07:54:00 -0000 [thread overview]
Message-ID: <4B95FEC2.8020500@technosis.de> (raw)
In-Reply-To: <m37hpmtxdf.fsf@fleche.redhat.com>
Hello Tom,
for my example string 'höhö' this code works for me, the 'ö' character
is number 246 in ASCII. I will start with some testing routines in the
next days.
best regards
Tom Tromey schrieb:
>>>>>> "Anton" == Anton Kunze <ak@technosis.de> writes:
>>>>>>
>
> Anton> http://websvn.kde.org/trunk/extragear/sdk/kdevelop/debuggers/gdb/printers/
>
> Also, the QStringPrinter code seems suspect to me:
>
> class QStringPrinter:
>
> def __init__(self, val):
> self.val = val
>
> def to_string(self):
> ret = ""
> i = 0
> while i < self.val['d']['size']:
> if self.val['d']['data'][i] > 256:
> #TODO: fix this properly
> ret += '?'
> else:
> ret += chr(self.val['d']['data'][i])
> i = i + 1
> return ret
>
> This is constructing a string by hand, and using '?' to replace some
> characters.
>
> It is better to use Value.string or Value.lazy_string. From the
> qstring.h in code search, I gather that this is UTF-16-encoded, so this
> should probably read:
>
> return self.val['d']['data'].string(encoding = 'UTF-16', length = self.val['d']['size'])
>
> ... though I have never really used Qt, so take with a grain of salt.
>
> Use lazy_string if you have a newer gdb.
>
> Tom
>
>
>
--
Anton Kunze
Entwicklung
_____________________________
Technosis GmbH
Kattrepelsbrücke 1
20095 Hamburg
Tel. +49 - (0)40-33 44 1990
Fax +49 - (0)40-33 44 1999
eMail: ak@technosis.de
_____________________________
Supporthotline: +49-(0)40-3344-1991
Support-eMail: support@technosis.de
Technosis GmbH, Geschäftsführer: Heiko Gerdau, Tobias Dittmar, Dierk
Rathjen, Sitz Hamburg; HRB 89145 Amtsgericht Hamburg
next prev parent reply other threads:[~2010-03-09 7:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-04 11:57 Anton Kunze
2010-03-04 18:09 ` Tom Tromey
2010-03-04 21:25 ` Anton Kunze
2010-03-05 8:33 ` Anton Kunze
2010-03-05 15:41 ` Tom Tromey
2010-03-08 9:00 ` Anton Kunze
2010-03-08 18:03 ` Tom Tromey
2010-03-09 7:49 ` Anton Kunze
2010-03-08 19:41 ` Tom Tromey
2010-03-09 7:54 ` Anton Kunze [this message]
2010-03-09 19:56 ` Niko Sams
2010-03-09 10:29 ` André Pönitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B95FEC2.8020500@technosis.de \
--to=ak@technosis.de \
--cc=gdb@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox