Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: gdb ml <gdb@sourceware.org>
Subject: Re: [RFC] string handling in python
Date: Mon, 07 Jul 2008 23:31:00 -0000	[thread overview]
Message-ID: <m3prpp9srd.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1215408302.1795.38.camel@localhost.localdomain> (Thiago Jung Bauermann's message of "Mon\, 07 Jul 2008 02\:25\:02 -0300")

>>>>> "Thiago" == Thiago Jung Bauermann <bauerman@br.ibm.com> writes:

Thiago> So, in my opinion for GDB's Python bindings we should always
Thiago> use Unicode strings, and convert to/from desired encodings as
Thiago> necessary. Strings provided by the user would be assumed to
Thiago> have host_charset () encoding, and strings coming from/going
Thiago> to the inferior would be assumed to have target_charset ()
Thiago> encoding.

Sounds reasonable to me.

I thought we already did some of this... search for host_charset in
the python directory.

Thiago> So for example, to create a value object of char * type using
Thiago> a string provided by the user or coming from Python code, GDB
Thiago> would first convert the Python string object (assumed to be in
Thiago> the host charset) to a unicode object (this process is called
Thiago> "decoding", in python parlance), and then convert it from
Thiago> unicode to a string in the target charset.

This sounds like a good candidate for convenience functions, one for
each direction.

Tom


  reply	other threads:[~2008-07-07 23:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-07  5:25 Thiago Jung Bauermann
2008-07-07 23:31 ` Tom Tromey [this message]
2008-07-08  5:31   ` Thiago Jung Bauermann
2008-07-08  5:35     ` Thiago Jung Bauermann

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=m3prpp9srd.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=bauerman@br.ibm.com \
    --cc=gdb@sourceware.org \
    /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