comparison roundup/rfc2822.py @ 2034:be047db3dd3d

Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
author Richard Jones <richard@users.sourceforge.net>
date Mon, 23 Feb 2004 05:29:06 +0000
parents fc52d57c6c3e
children 443fce9e92ae
comparison
equal deleted inserted replaced
2033:d11ba8f375cb 2034:be047db3dd3d
117 for section in _decode_header(hdr): 117 for section in _decode_header(hdr):
118 charset = unaliasCharset(section[1]) 118 charset = unaliasCharset(section[1])
119 outs += unicode(section[0], charset or 'iso-8859-1', 'replace') 119 outs += unicode(section[0], charset or 'iso-8859-1', 'replace')
120 return outs.encode('utf-8') 120 return outs.encode('utf-8')
121 121
122 def encode_header(header): 122 def encode_header(header, charset='utf-8'):
123 """ Will encode in quoted-printable encoding only if header 123 """ Will encode in quoted-printable encoding only if header
124 contains non latin characters 124 contains non latin characters
125 """ 125 """
126 126
127 # Return empty headers unchanged 127 # Return empty headers unchanged
130 130
131 # return plain header if it is not contains non-ascii characters 131 # return plain header if it is not contains non-ascii characters
132 if hqre.match(header): 132 if hqre.match(header):
133 return header 133 return header
134 134
135 charset = 'utf-8'
136 quoted = '' 135 quoted = ''
137 #max_encoded = 76 - len(charset) - 7 136 #max_encoded = 76 - len(charset) - 7
138 for c in header: 137 for c in header:
139 # Space may be represented as _ instead of =20 for readability 138 # Space may be represented as _ instead of =20 for readability
140 if c == ' ': 139 if c == ' ':

Roundup Issue Tracker: http://roundup-tracker.org/