[Python-checkins] python/dist/src/Lib/email Charset.py,1.16,1.17
bwarsaw at users.sourceforge.net
bwarsaw at users.sourceforge.net
Sat Oct 9 23:08:33 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29677
Modified Files:
Charset.py
Log Message:
__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.
Index: Charset.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Charset.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- Charset.py 3 Oct 2004 03:16:18 -0000 1.16
+++ Charset.py 9 Oct 2004 21:08:30 -0000 1.17
@@ -185,8 +185,9 @@
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
More information about the Python-checkins
mailing list