From e879f7fa2f3a50dcb1d5fe270abc31ba4383b8fd Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 27 Apr 2006 16:03:17 +0000 Subject: [PATCH] Ignore case comparing charsets. git-svn-id: file:///home/phd/archive/SVN/mimedecode@11 a778b35f-2f12-0410-a9f6-9b1356d76ba6 --- mimedecode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mimedecode.py b/mimedecode.py index 1e6852c..f819b84 100755 --- a/mimedecode.py +++ b/mimedecode.py @@ -64,7 +64,7 @@ def recode(s, charset): def recode2(s, charset): - if charset and charset <> GlobalOptions.default_charset: + if charset and charset.lower() <> GlobalOptions.default_charset: s = recode(s, charset) return s @@ -198,7 +198,7 @@ def recode_charset(msg, s): "Recode charset of the message to the default charset" save_charset = charset = msg.get_content_charset() - if charset and charset <> GlobalOptions.default_charset: + if charset and charset.lower() <> GlobalOptions.default_charset: s = recode2(s, charset) content_type = msg.get_content_type() set_content_type(msg, content_type, GlobalOptions.default_charset) @@ -316,6 +316,8 @@ class GlobalOptions: else: default_charset = sys.getdefaultencoding() + default_charset = default_charset.lower() + recode_charset = 1 # recode charset of message body decode_headers = ["Subject", "From"] # A list of headers to decode -- 2.39.5