New submission from sijian liang: #!/usr/bin/python #-*- coding:utf-8 -*- import email # from email.parser import Parser def decode_email_header(header, sep=''): l = [] for s, c in header: if c: l.append(s.decode(c)) else: l.append(s) return sep.join(l) s = email.Header.decode_header('"=?gb18030?B?bWFpbGZvcnRlc3R0?=" <2070776...@qq.com>') print decode_email_header(s) s = email.Header.decode_header('=?gb18030?B?bWFpbGZvcnRlc3R0?= <2070776...@qq.com>') print decode_email_header(s)
# see output: # "=?gb18030?B?bWFpbGZvcnRlc3R0?=" <2070776...@qq.com> # mailfortestt<2070776...@qq.com> ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28122> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com