From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17185 invoked by alias); 15 Jul 2009 18:24:25 -0000 Received: (qmail 17164 invoked by uid 22791); 15 Jul 2009 18:24:22 -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; Wed, 15 Jul 2009 18:24:13 +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 n6FIOAxP004376; Wed, 15 Jul 2009 14:24:10 -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 n6FIO9Ut022028; Wed, 15 Jul 2009 14:24:09 -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 n6FIO8gj003882; Wed, 15 Jul 2009 14:24:09 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id D835C3782F7; Wed, 15 Jul 2009 12:24:07 -0600 (MDT) To: ke@alum.bu.edu Cc: gdb-patches@sourceware.org Subject: Re: iconv returning byte order marks for Solaris 2.9 References: <71415.13770.qm@web33803.mail.mud.yahoo.com> From: Tom Tromey Reply-To: tromey@redhat.com Date: Wed, 15 Jul 2009 18:57:00 -0000 In-Reply-To: <71415.13770.qm@web33803.mail.mud.yahoo.com> (Andrew's message of "Wed\, 15 Jul 2009 10\:16\:47 -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/msg00396.txt.bz2 >>>>> "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 __STDC_ISO_10646__. Tom