gnupg-1.0.2 patch: LC_CTYPE needs to be imported

Edmund GRIMLEY EVANS edmundo@rano.org
Wed, 16 Aug 2000 16:32:06 +0100


I'd forgotten I was on this list, it has been so quiet.

I expect the glibc people can give you a more authoritative answer,
but here's my opinion anyway.

Daniel Resare <noa@metamatrix.se>:


> 1) Ask the glibc maintainers kindly not to let the LC_CTYPE
> affect console output. That behaviour is IMHO unobvious and
> should be considered an extention so large that a new LC_
> category could be invented for the purpose.
I assume that what's happening is that gettext is converting messages into the locale charset in order to display them. This behaviour is correct: if you have German messages stored in ISO-8859-1 and the locale charset is UTF-8, or vice versa, then you have to convert the messages before displaying them. If the locale charset is US-ASCII then the conversion is non-reversible. (What's it doing in fact? Does it change Ä to AE?) By the way, I think there's no guarantee that the charset of the portable "C" locale is US-ASCII. Today it usually is, but in the future it might more often be UTF-8. It seems to me quite reasonable that the locale charset depends on LC_CTYPE. You couldn't really have the behaviour of isalpha() being independent of the locale charset.
> 2) wrap all calls to the ctype.h functions (isalpha() and friends
> in setlocale(LC_CTYPE, "C")) (some grep'ing shows 56 occurances)
Yuck.
> 3) review all uses of the ctype.h functions and perhaps use the
> isascii() function instead where appliciable (according to
> the manpage isascii() is a BSD and SVID extension and should
> be quite widely available)
>
> 4) write platform indipendent replacements of the used ctype.h
> functions that check against the US-ASCII charset. (Shouldn't
> be difficult)
To me, these solutions look best. You could use a configure test to choose between them. I assume that either way you're assuming that the locale charset is compatible with US-ASCII, so GnuPG won't work in an EBCDIC locale, but who cares. Edmund