Re: Dangerous locale patch to 1.1.3

[email protected] 10 Oct 2002 10:51:25 -0400
Newsgroups gmane.mail.ifile.general
Organization Massachvsetts Institvte of Technology
Message-ID <[email protected]>
Jason Rennie <[email protected]> writes:

> If I understand correctly, setlocale(LC_CTYPE, "") will look to the 
> environment variable LC_CTYPE for the character encoding instead of the 
> default, "C".  Is this right?  What happens if you don't have LC_CTYPE 
> set?

It's actually a bit more complicated than that, using, in decreasing
order of precedence, getenv("LC_ALL"), getenv("LC_CTYPE"),
getenv("LANG"), and the previously set value (initially "C").

> Let us know how it goes.  I think we should understand what's going to 
> happen before applying the patch.

Indeed.  The Right Thing would probably be to look at the character
sets specified in Content-Type: headers, but then you have to take
care with multipart messages, and messages with missing or incorrect
content types are still a problem.  (OTOH, parsing Content-Type should
also allow saner treatment of non-textual content without requiring an
extra filter, which counts as a win in my book.)

-- 
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
Finger [email protected] (NOT a valid e-mail address) for more info.