diff options
Diffstat (limited to 'alot/db/utils.py')
-rw-r--r-- | alot/db/utils.py | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py index 86c4718b..8a96df14 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -323,7 +323,7 @@ def extract_headers(mail, headers=None): for key in headers: value = '' if key in mail: - value = decode_header(mail.get(key, '')) + value = mail.get(key, '') headertext += '%s: %s\n' % (key, value) return headertext @@ -474,32 +474,6 @@ def formataddr(pair): return "{0} <{1}>".format(name, address) -def decode_header(header, normalize=False): - """ - decode a header value to a unicode string - - values are usually a mixture of different substrings - encoded in quoted printable using different encodings. - This turns it into a single unicode string - - :param header: the header value - :type header: str - :param normalize: replace trailing spaces after newlines - :type normalize: bool - :rtype: str - """ - logging.debug("unquoted header: |%s|", header) - - valuelist = email.header.decode_header(header) - decoded_list = [] - for v, enc in valuelist: - v = string_decode(v, enc) - decoded_list.append(string_sanitize(v)) - value = ''.join(decoded_list) - if normalize: - value = re.sub(r'\n\s+', r' ', value) - return value - def is_subdir_of(subpath, superpath): # make both absolute |