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> In the system I'm working iconv_open doesn't accept "wchar_t" as
Andrew> encoding name. It failed when INTERMEDIATE_ENCODING was set to
Andrew> that.

Ah, thanks.

Andrew> But setting INTERMEDIATE_ENCODING to "UCS-4BE" eliminated the
Andrew> BOM in the beginning.

Great.  Could you try the appended patch?
I'm testing it on Linux.


diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
index 07a6c87..241e051 100644
--- a/gdb/gdb_wchar.h
+++ b/gdb/gdb_wchar.h
@@ -35,8 +35,6 @@
    wrappers for the wchar_t functionality we use.  */
-#define INTERMEDIATE_ENCODING "wchar_t"
 #if defined (HAVE_ICONV)
 #include <iconv.h>
@@ -63,6 +61,20 @@ typedef wint_t gdb_wint_t;
 #define LCST(X) L ## X
+#ifdef __STDC_ISO_10646__
+/* On Solaris 9, iconv_open does not accept "wchar_t".  So, on this
+   platform, and other platforms where wchar_t is known to use
+   ISO-10646, choose an appropriate explicit charset name.  Also,
+   UCS-4 on Solaris will emit a BOM, which we don't want.  So, we
+   choose an explicit little- or big-endian variant, depending on the
+   host.  */
 typedef char gdb_wchar_t;
@@ -87,4 +99,8 @@ typedef int gdb_wint_t;
+#define INTERMEDIATE_ENCODING "wchar_t"
 #endif /* GDB_WCHAR_H */

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