aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman
diff options
context:
space:
mode:
authortkikuchi <>2006-01-09 07:33:36 +0000
committertkikuchi <>2006-01-09 07:33:36 +0000
commite6677adc3deba62d4a05c0ff4ce891ec09b9a925 (patch)
treed70e5594f513ae1e8b2b8fa63aebd637d2f74c9b /Mailman
parent4507d9700b57f35d54f9cc4701f23ac82dcc36e7 (diff)
downloadmailman2-e6677adc3deba62d4a05c0ff4ce891ec09b9a925.tar.gz
mailman2-e6677adc3deba62d4a05c0ff4ce891ec09b9a925.tar.xz
mailman2-e6677adc3deba62d4a05c0ff4ce891ec09b9a925.zip
Text file '@' obfuscation bug (unicode) fix. Thanks Mark.
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/Archiver/HyperArch.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py
index 732ab10e..bd3802bc 100644
--- a/Mailman/Archiver/HyperArch.py
+++ b/Mailman/Archiver/HyperArch.py
@@ -569,16 +569,21 @@ class Article(pipermail.Article):
if d['_message_id']:
headers.append('Message-ID: %(_message_id)s')
body = EMPTYSTRING.join(self.body)
- if isinstance(body, types.UnicodeType):
- body = body.encode(Utils.GetCharSet(self._lang), 'replace')
+ cset = Utils.GetCharSet(self._lang)
+ # Coerce the body to Unicode and replace any invalid characters.
+ if not isinstance(body, types.UnicodeType):
+ body = unicode(body, cset, 'replace')
if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS:
otrans = i18n.get_translation()
try:
+ atmark = unicode(_(' at '), cset)
i18n.set_language(self._lang)
body = re.sub(r'([-+,.\w]+)@([-+.\w]+)',
- '\g<1>' + _(' at ') + '\g<2>', body)
+ '\g<1>' + atmark + '\g<2>', body)
finally:
i18n.set_translation(otrans)
+ # Return body to character set of article.
+ body = body.encode(cset, 'replace')
return NL.join(headers) % d + '\n\n' + body + '\n'
def _set_date(self, message):