This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Iconv / Solaris
>>>>> "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