From 36ffb71420a9643be3c38d1250bfd191ccaa86f2 Mon Sep 17 00:00:00 2001 From: Christine Spang Date: Tue, 19 Nov 2013 20:41:57 -0800 Subject: [PATCH] Subject wrapper should inherit from unicode, not str. This wrapper is used in the implementation of clean_subject(). Since all headers are returned as unicode objects, it will cause a UnicodeDecodeError if the subject contains unicode and clean_subject() is called. --- flanker/mime/message/headers/wrappers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flanker/mime/message/headers/wrappers.py b/flanker/mime/message/headers/wrappers.py index 3ca694d..5c5bb47 100644 --- a/flanker/mime/message/headers/wrappers.py +++ b/flanker/mime/message/headers/wrappers.py @@ -170,11 +170,11 @@ class MessageId(str): yield cls(message_id) -class Subject(str): +class Subject(unicode): RE_RE = re.compile("((RE|FW|FWD|HA)([[]\d])*:\s*)*", re.I) def __new__(cls, *args, **kw): - return str.__new__(cls, *args, **kw) + return unicode.__new__(cls, *args, **kw) def strip_replies(self): return self.RE_RE.sub('', self) -- 2.43.0