Skip to content
Snippets Groups Projects
Commit 4924b0ff authored by Tokio Kikuchi's avatar Tokio Kikuchi
Browse files

being strict on u2u_decode() return type

parent 92023cb6
No related branches found
No related tags found
No related merge requests found
...@@ -903,9 +903,14 @@ def u2u_decode(s): ...@@ -903,9 +903,14 @@ def u2u_decode(s):
# utility function for (final) decoding of mime header # utility function for (final) decoding of mime header
# note: resulting string is in one line (no \n within) # note: resulting string is in one line (no \n within)
# note2: spaces between enc_words are stripped (see RFC2047) # note2: spaces between enc_words are stripped (see RFC2047)
# note3: strict on return unicode string type
s = ''.join(s.splitlines()) s = ''.join(s.splitlines())
s = sre.sub('?==?', s) s = sre.sub('?==?', s)
u = mre.sub(decode_mime, s) u = mre.sub(decode_mime, s)
if type(u) != UnicodeType:
# replace character is not in ascii range. :-(
u = unicode(unicode(u, 'us-ascii', 'replace'
).encode('us-ascii', 'replace'), 'us-ascii')
return u return u
def oneline(s, cset): def oneline(s, cset):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment