diff options
author | Barry Warsaw <barry@python.org> | 2002-06-29 03:26:58 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2002-06-29 03:26:58 (GMT) |
commit | 8e69bdac33710400b9322a1468fa81f3741edcf7 (patch) | |
tree | 0c72e17267b025ae3d491642a13868a856d40a5e | |
parent | ae64f3adcd4b9f11710520ad47075930e175cd1d (diff) | |
download | cpython-8e69bdac33710400b9322a1468fa81f3741edcf7.zip cpython-8e69bdac33710400b9322a1468fa81f3741edcf7.tar.gz cpython-8e69bdac33710400b9322a1468fa81f3741edcf7.tar.bz2 |
__unicode__(): Patch # 541263 by Mikhail Zabaluev, implementation
modified by Barry.
-rw-r--r-- | Lib/email/Header.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/email/Header.py b/Lib/email/Header.py index c72f64d..e02ccb8 100644 --- a/Lib/email/Header.py +++ b/Lib/email/Header.py @@ -142,6 +142,12 @@ class Header: """A synonym for self.encode().""" return self.encode() + def __unicode__(self): + """Helper for the built-in unicode function.""" + # charset item is a Charset instance so we need to stringify it. + uchunks = [unicode(s, str(charset)) for s, charset in self._chunks] + return u''.join(uchunks) + def append(self, s, charset=None): """Append string s with Charset charset to the MIME header. |