diff options
author | Barry Warsaw <barry@python.org> | 2002-10-10 15:11:20 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2002-10-10 15:11:20 (GMT) |
commit | 14fc464ec9b0e4ac0e62af515740e9bb0a5ea448 (patch) | |
tree | 5f43fc92ee898e68221d14e3e1075af6d313ba45 /Lib/email | |
parent | d4f7da3cd7545d77d283cfee637f2a88385dea7a (diff) | |
download | cpython-14fc464ec9b0e4ac0e62af515740e9bb0a5ea448.zip cpython-14fc464ec9b0e4ac0e62af515740e9bb0a5ea448.tar.gz cpython-14fc464ec9b0e4ac0e62af515740e9bb0a5ea448.tar.bz2 |
__init__(): RFC 2046 $4.1.2 says charsets are not case sensitive.
Coerce the argument to lower case. Also, since body encodings can't
be SHORTEST, default the CHARSETS failobj's second item to BASE64.
Diffstat (limited to 'Lib/email')
-rw-r--r-- | Lib/email/Charset.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/email/Charset.py b/Lib/email/Charset.py index 9a7e510..67cc1ec 100644 --- a/Lib/email/Charset.py +++ b/Lib/email/Charset.py @@ -177,13 +177,15 @@ 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() # 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 # charset_map dictionary. Try that first, but let the user override # it. henc, benc, conv = CHARSETS.get(self.input_charset, - (SHORTEST, SHORTEST, None)) + (SHORTEST, BASE64, None)) # Set the attributes, allowing the arguments to override the default. self.header_encoding = henc self.body_encoding = benc |