NetBSD Problem Report #39765
From jmcneill@black.invisible.ca Sat Oct 18 23:13:59 2008
Return-Path: <jmcneill@black.invisible.ca>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 67A1763B93C
for <gnats-bugs@gnats.NetBSD.org>; Sat, 18 Oct 2008 23:13:59 +0000 (UTC)
Message-Id: <20081018231354.CF6BC7D9BC0@black.invisible.ca>
Date: Sat, 18 Oct 2008 19:13:54 -0400 (EDT)
From: jmcneill@invisible.ca
Reply-To: jmcneill@invisible.ca
To: gnats-bugs@gnats.NetBSD.org
Subject: glib2 does not support WCHAR_T conversion using built-in iconv on NetBSD
X-Send-Pr-Version: 3.95
>Number: 39765
>Category: pkg
>Synopsis: glib2 does not support WCHAR_T conversion using built-in iconv on NetBSD
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Oct 18 23:15:00 +0000 2008
>Last-Modified: Sun Oct 19 13:50:02 +0000 2008
>Originator: Jared D. McNeill
>Release: NetBSD 4.99.73
>Organization:
>Environment:
System: NetBSD black.invisible.ca 4.99.73 NetBSD 4.99.73 (GENERIC) #10: Sat Oct 18 12:27:54 EDT 2008 jmcneill@black.invisible.ca:/export/home/jmcneill/branches/HEAD/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
g_convert fails when trying to convert to or from WCHAR_T on NetBSD
because of limitations in the system iconv implementation. glibmm
uses this in its ustring class implementation, so any application
using glibmm will fail.
>How-To-Repeat:
Build the following application on NetBSD:
$ cc glibconvert.c -o glibconvert `pkg-config --cflags --libs glib-2.0`
$ ./glibconvert
** (process:5615): WARNING **: g_convert failed: Conversion from character set 'UTF-8' to 'WCHAR_T' is not supported
The same application works fine on Linux:
$ ./glibconvert
** Message: g_convert success
/* g_convert test application */
#include <glib.h>
int
main(void)
{
GError *gerror = NULL;
gsize read, written;
gchar *convstr;
convstr = g_convert("hello", 5,
"WCHAR_T", "UTF-8", &read, &written,
&gerror);
if (convstr == NULL)
g_warning("g_convert failed: %s\n", gerror->message);
else
g_message("g_convert success\n");
return 0;
}
>Fix:
>Audit-Trail:
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/39765: glib2 does not support WCHAR_T conversion using
built-in iconv on NetBSD
Date: Sun, 19 Oct 2008 10:49:13 +0200
On Sat, Oct 18, 2008 at 11:15:00PM +0000, jmcneill@invisible.ca wrote:
> g_convert fails when trying to convert to or from WCHAR_T on NetBSD
> because of limitations in the system iconv implementation. glibmm
> uses this in its ustring class implementation, so any application
> using glibmm will fail.
I disagree with this analyses. glibmm makes the assumption that the
internal encoding is constant, which is not valid. The correct code to
use here is nl_langinfo to extract CODESET, use iconv to convert to that
and then do a normal mbstowcs.
Joerg
From: "Jared D. McNeill" <jmcneill@invisible.ca>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org,
pkgsrc-bugs@netbsd.org
Subject: Re: pkg/39765: glib2 does not support WCHAR_T conversion using built-in
iconv on NetBSD
Date: Sun, 19 Oct 2008 09:49:17 -0400
Joerg Sonnenberger wrote:
> I disagree with this analyses. glibmm makes the assumption that the
> internal encoding is constant, which is not valid. The correct code to
> use here is nl_langinfo to extract CODESET, use iconv to convert to that
> and then do a normal mbstowcs.
glib should not behave different on NetBSD than Linux.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.36 2007/11/24 03:27:39 kano Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.