This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: iconv returning byte order marks for Solaris 2.9
- From: Tom Tromey <tromey at redhat dot com>
- To: ke at alum dot bu dot edu
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 15 Jul 2009 12:24:06 -0600
- Subject: Re: iconv returning byte order marks for Solaris 2.9
- References: <71415.13770.qm@web33803.mail.mud.yahoo.com>
- Reply-to: tromey at redhat dot com
>>>>> "Andrew" == Andrew <ke@alum.bu.edu> writes:
Andrew> I found a problem printing strings for gdb 6.8 weekly snapshot
Andrew> (2009 07 07) on Solaris 2.9.
Thanks for finding and diagnosing this.
Andrew> I eventually found that changing INTERMEDIATE_ENCODING
Andrew> in gdb_wchar.h to "UCS-4" and applying the following
Andrew> patch worked. Any comments?
Andrew> I'm not sure how to handle the INTERMEDIATE_ENCODING
Andrew> change, since it's probably system dependent.
I don't have access to Solaris. If I understand correctly, the
situation is:
* wchar_t on Solaris is encoded using UCS-4
* iconv_open accepts "wchar_t" as an encoding name
* in this case, iconv emits a BOM
First, this seems like it must be a Solaris bug, just because I can't
imagine how this would be useful.
I don't think we can use your patch as-is. It does the BOM elimination
unconditionally, but really I think we can only do it on platforms where
we know that wchar_t is UCS-4 (or UCS-2 I suppose).
Does Solaris 9 support a full suite of conversions? If not, one option
would be to use libiconv, and find a way to disable most of this code by
default on Solaris.
Failing that, the simplest fix would be if there is an encoding
(compatible with wchar_t) we can use on Solaris which does not insert
the BOM. For example, maybe "UCS-4BE" or "UCS-4LE", depending on the
architecture. I think a fix like this could be done entirely in
gdb_wchar.h. Could you try that?
As far as the host dependency, we can probably just check
__STDC_ISO_10646__.
Tom