bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gettext bug when translating strings from iso88592-2


From: Tomasz Torcz
Subject: Re: Gettext bug when translating strings from iso88592-2
Date: Thu, 26 Aug 2004 00:38:21 +0200
User-agent: Mutt/1.5.4i

On Mon, Aug 23, 2004 at 03:35:40PM +0200, Bruno Haible wrote:
> Tomasz Torcz wrote:
> >  Program has strings in latin2 (iso-8859-2):
> 
> >         char *good = _("good");
> >         char *bad = _("bąd"); /* contains characte in iso 8859-2 */
> >
> >         setlocale(LC_ALL, "");
> >         textdomain("example");
> 
> There are two problems with your program:
> 
> 1) You fetch the translations before having set the locale and textdomain;
> therefore the _(...) here will do nothing.

 Oh yeah, I really screw test case. Sorry for that.
 
> 2) You expect that gettext will somehow convert the msgid from iso-8859-2
> (your source encoding) to utf-8 (the PO file's encoding). This is not
> true: the gettext documentation says
>   "Note that the MSGID argument to `gettext' is not subject to
> character set conversion.  Also, when `gettext' does not find a
> translation for MSGID, it returns MSGID unchanged - independently of
> the current output character set.  It is therefore recommended that all
> MSGIDs be US-ASCII strings."

 gettext doesn't do conversion on runtime. OK, that's perfectly
reasonable and that's not a bug. But xgettext is doing conversion.
In fact, xgettext won't run without doing conversion - it insist on
using --from-code, which in turn does conversion. That looks like a bug
for me.
 
> A possible solution for you is to change your source code to UTF-8.
> Another possible solution is to convert the msgid yourself from ISO-8859-2
> to UTF-8 before passing it to the gettext function.

 It's rather impossible, program I'm working on have to work on
terminals properly configured to display and enter iso-8859-2. UTF-8 is
not an option. We were looking for gettext as a way to translate over
program to english.

-- 
Tomasz Torcz                Only gods can safely risk perfection,     
address@hidden     it's a dangerous thing for a man.  -- Alia





reply via email to

[Prev in Thread] Current Thread [Next in Thread]