summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/Charset.py5
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