Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: Iconv / Solaris
Date: Fri, 28 Aug 2009 01:01:00 -0000	[thread overview]
Message-ID: <m3ljl4pxey.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20090827204258.GB13388@caradoc.them.org> (Daniel Jacobowitz's 	message of "Thu, 27 Aug 2009 16:42:58 -0400")

>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

Daniel> Maybe I'm thinking about this wrong... can we determine the
Daniel> encoding of wchar_t somehow that works on Solaris?  Something
Daniel> like what we do now with nl_langinfo?

Nope.

For the "narrow" charset you can use nl_langinfo(CODESET).
There is no equivalent for the wide charset :-(

Many systems let you pass "wchar_t" to iconv_open, instead.
However, Solaris doesn't.

Daniel> Or is it not guaranteed to have any known encoding?

If the system defines __STDC_ISO_10646__, then you know it uses Unicode.

Otherwise, all bets are off.

Daniel> I'm lost in the configure maze

Yeah.  The way it works:

* If you have a fully working iconv + wchar_t suite, then:
  - All the gdb_* macros are defined as their wide counterparts,
    e.g. gdb_iswprint == iswprint
  The intermediate charset is wchar_t.

* You might have iconv but no working wchar_t support.
  In this case we use the narrow forms for everything,
  e.g., gdb_iswprint == isprint (and gdb_wchar_t == char).
  However we still use iconv for recoding.
  The intermediate charset is host_charset.

  This is the scenario I propose we make Solaris use, preferably by
  using AC_TRY_RUN to test iconv_open.
  The impact on the user is that if he tries to print a string with
  non-host-charset characters, he will get escapes -- basically what GDB
  6.8 does.

* You might have nothing at all.  This is the PHONY_ICONV case.
  In this scenario we use the narrow forms for everything and basically
  just fail unless host_charset == target_charset.

Tom


  parent reply	other threads:[~2009-08-28  0:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-27  2:22 Daniel Jacobowitz
2009-08-27 17:09 ` Tom Tromey
2009-08-27 17:45   ` Daniel Jacobowitz
2009-08-27 20:36     ` Tom Tromey
2009-08-27 20:38       ` Daniel Jacobowitz
2009-08-27 20:50         ` Daniel Jacobowitz
2009-08-27 22:03           ` Daniel Jacobowitz
2009-08-28  1:01           ` Tom Tromey [this message]
2009-08-28  1:24         ` Tom Tromey
2009-08-28 17:00           ` Tom Tromey

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=m3ljl4pxey.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@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