diff options
author | Barry Warsaw <barry@python.org> | 2004-10-09 21:08:30 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2004-10-09 21:08:30 (GMT) |
commit | ea7c7af10b72ec4f3c5ad2bb6beb1d3667ff978e (patch) | |
tree | fb408611cefcaa20026b6d172f4da6f837702cf5 /Lib/email/Charset.py | |
parent | 19717fa33a58be7da6663711de9496c99d629df9 (diff) | |
download | cpython-ea7c7af10b72ec4f3c5ad2bb6beb1d3667ff978e.zip cpython-ea7c7af10b72ec4f3c5ad2bb6beb1d3667ff978e.tar.gz cpython-ea7c7af10b72ec4f3c5ad2bb6beb1d3667ff978e.tar.bz2 |
__init__(): Coerce the input_charset to unicode (with ascii encoding) before
calling .lower() on it. This fixes the problem described in SF patch # 866982
where in the tr_TR.ISO-8859-9 locale, 'I'.lower() isn't 'i'. unicodes are
locale insensitive.
Diffstat (limited to 'Lib/email/Charset.py')
-rw-r--r-- | Lib/email/Charset.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/email/Charset.py b/Lib/email/Charset.py index 6a3e3ca..df860c5 100644 --- a/Lib/email/Charset.py +++ b/Lib/email/Charset.py @@ -185,8 +185,9 @@ class Charset: this attribute will have the same value as the input_codec. """ def __init__(self, input_charset=DEFAULT_CHARSET): - # RFC 2046, $4.1.2 says charsets are not case sensitive - input_charset = input_charset.lower() + # RFC 2046, $4.1.2 says charsets are not case sensitive. We coerce to + # unicode because its .lower() is locale insensitive. + input_charset = unicode(input_charset, 'ascii').lower() # Set the input charset after filtering through the aliases self.input_charset = ALIASES.get(input_charset, input_charset) # We can try to guess which encoding and conversion to use by the |