diff options
author | Guido van Rossum <guido@python.org> | 2007-05-02 19:09:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-02 19:09:54 (GMT) |
commit | ef87d6ed94780fe00250a551031023aeb2898365 (patch) | |
tree | 1f8989aaaec7ec5f8b2f26498317f2022bf85531 /Lib/email/charset.py | |
parent | 572dbf8f1320c0b34b9c786e5c30ba4a4b61b292 (diff) | |
download | cpython-ef87d6ed94780fe00250a551031023aeb2898365.zip cpython-ef87d6ed94780fe00250a551031023aeb2898365.tar.gz cpython-ef87d6ed94780fe00250a551031023aeb2898365.tar.bz2 |
Rip out all the u"..." literals and calls to unicode().
Diffstat (limited to 'Lib/email/charset.py')
-rw-r--r-- | Lib/email/charset.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/email/charset.py b/Lib/email/charset.py index 9bebf6f..5b5e95d 100644 --- a/Lib/email/charset.py +++ b/Lib/email/charset.py @@ -202,10 +202,10 @@ class Charset: # is already a unicode, we leave it at that, but ensure that the # charset is ASCII, as the standard (RFC XXX) requires. try: - if isinstance(input_charset, unicode): + if isinstance(input_charset, str): input_charset.encode('ascii') else: - input_charset = unicode(input_charset, 'ascii') + input_charset = str(input_charset, 'ascii') except UnicodeError: raise errors.CharsetError(input_charset) input_charset = input_charset.lower() @@ -264,7 +264,7 @@ class Charset: def convert(self, s): """Convert a string from the input_codec to the output_codec.""" if self.input_codec != self.output_codec: - return unicode(s, self.input_codec).encode(self.output_codec) + return str(s, self.input_codec).encode(self.output_codec) else: return s @@ -281,10 +281,10 @@ class Charset: Characters that could not be converted to Unicode will be replaced with the Unicode replacement character U+FFFD. """ - if isinstance(s, unicode) or self.input_codec is None: + if isinstance(s, str) or self.input_codec is None: return s try: - return unicode(s, self.input_codec, 'replace') + return str(s, self.input_codec, 'replace') except LookupError: # Input codec not installed on system, so return the original # string unchanged. @@ -307,7 +307,7 @@ class Charset: codec = self.output_codec else: codec = self.input_codec - if not isinstance(ustr, unicode) or codec is None: + if not isinstance(ustr, str) or codec is None: return ustr try: return ustr.encode(codec, 'replace') |