From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5784 invoked by alias); 17 Jul 2009 19:03:08 -0000 Received: (qmail 5378 invoked by uid 22791); 17 Jul 2009 19:03:05 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 17 Jul 2009 19:03:00 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6HJ2v4W021302; Fri, 17 Jul 2009 15:02:57 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6HJ2tOj030538; Fri, 17 Jul 2009 15:02:56 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6HJ2str018066; Fri, 17 Jul 2009 15:02:55 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 8E1733780F2; Fri, 17 Jul 2009 13:02:54 -0600 (MDT) To: ke@alum.bu.edu Cc: gdb-patches@sourceware.org Subject: Re: iconv returning byte order marks for Solaris 2.9 References: <466695.44735.qm@web33802.mail.mud.yahoo.com> From: Tom Tromey Reply-To: tromey@redhat.com Date: Fri, 17 Jul 2009 19:19:00 -0000 In-Reply-To: <466695.44735.qm@web33802.mail.mud.yahoo.com> (Andrew's message of "Wed\, 15 Jul 2009 12\:50\:41 -0700 \(PDT\)") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00436.txt.bz2 >>>>> "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. 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 #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 */