This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: iconv returning byte order marks for Solaris 2.9

>>>>> "Andrew" == Andrew  <> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]