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

Re: setlocale() and gettext() (Re: CVS dpkg flaws)



At Mon, 31 Dec 2001 15:50:09 +0100,
Wichert Akkerman wrote:

> > Because AFAIK gettext() converts message's encoding as locale configurations.
> > If it fails, it'll output the characters as `?'.
> 
> Oh bugger,  so gettext has overloaded the meaning of LC_CTYPE to make
> it also the indicater for the output character set. From the setlocale
> manpage:
> 
>        LC_CTYPE
>               for  regular expression matching, character classi
>               fication,  conversion,  case-sensitive  comparison,
>               and wide character functions.
> 
> I would consider this a very nasty bug in gettext
> 
> Can you try the (untested) patch below? That tries to work around this
> problem by setting and resetting LC_CTYPE in the version comparison
> routines.

I'm not untested, but why don't set/restore LC_CTYPE locale
in lib/vercmp.c:ververcmp() ?

versionsatisfied() calls versionsatisfied3(), and versionsatisfied3()
calls versioncompare(). All these calls finally use ververcmp(), so
I think putting set/restore locale in ververcmp() is simple.
Anyway, your patch may break some error message, since internerr()
uses gettext().

Alternatively, how about implement locale unsensible
isdigit() and isalpha() if we uses only US-ASCII charset?
It's not so difficult to implement these, isn't it?

Happy New Year! (from Japan)
Fumitoshi UKAI



Reply to: