From: Tom Tromey <tromey@redhat.com>
To: ke@alum.bu.edu
Cc: gdb-patches@sourceware.org
Subject: Re: iconv returning byte order marks for Solaris 2.9
Date: Fri, 17 Jul 2009 19:19:00 -0000 [thread overview]
Message-ID: <m33a8v5e01.fsf@fleche.redhat.com> (raw)
In-Reply-To: <466695.44735.qm@web33802.mail.mud.yahoo.com> (Andrew's message of "Wed\, 15 Jul 2009 12\:50\:41 -0700 \(PDT\)")
>>>>> "Andrew" == Andrew <ke@alum.bu.edu> 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.
Tom
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>
#else
@@ -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. */
+#if WORDS_BIGENDIAN
+#define INTERMEDIATE_ENCODING "UCS-4BE"
+#else
+#define INTERMEDIATE_ENCODING "UCS-4LE"
+#endif
+#endif
+
#else
typedef char gdb_wchar_t;
@@ -87,4 +99,8 @@ typedef int gdb_wint_t;
#endif
+#ifndef INTERMEDIATE_ENCODING
+#define INTERMEDIATE_ENCODING "wchar_t"
+#endif
+
#endif /* GDB_WCHAR_H */
next prev parent reply other threads:[~2009-07-17 19:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-15 18:28 Andrew
2009-07-15 18:57 ` Tom Tromey
2009-07-16 2:29 ` Andrew
2009-07-17 19:19 ` Tom Tromey [this message]
2009-07-21 20:18 ` Andrew
2009-07-24 21:58 ` Tom Tromey
2009-08-14 20:13 ` 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=m33a8v5e01.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=ke@alum.bu.edu \
/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