Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/email/charset.py

    r2 r391  
    1010    ]
    1111
     12import codecs
    1213import email.base64mime
    1314import email.quoprimime
     
    187188                   body_encoding.
    188189
    189     output_charset: Some character sets must be converted before the can be
     190    output_charset: Some character sets must be converted before they can be
    190191                    used in email headers or bodies.  If the input_charset is
    191192                    one of them, this attribute will contain the name of the
     
    213214        except UnicodeError:
    214215            raise errors.CharsetError(input_charset)
    215         input_charset = input_charset.lower()
    216         # Set the input charset after filtering through the aliases
     216        input_charset = input_charset.lower().encode('ascii')
     217        # Set the input charset after filtering through the aliases and/or codecs
     218        if not (input_charset in ALIASES or input_charset in CHARSETS):
     219            try:
     220                input_charset = codecs.lookup(input_charset).name
     221            except LookupError:
     222                pass
    217223        self.input_charset = ALIASES.get(input_charset, input_charset)
    218224        # We can try to guess which encoding and conversion to use by the
Note: See TracChangeset for help on using the changeset viewer.