[Mailman-Developers] Serious Archiving problem in 2.1.7
Tokio Kikuchi
tkikuchi at is.kochi-u.ac.jp
Fri Jan 6 01:01:45 CET 2006
Thank you Mark. It looks like we reached the same conclusion.
One note: I prefer to use unicode() than decode() because the latter is
not supported in Python 2.1 and looks like fuzzy in declaring unicode
string (or else).
Mark Sapiro wrote:
> Tokio Kikuchi wrote:
>
>>At my first glance, it will only work for english lists in which the
>>replace parameter _(' at ') is the same both in unicode and ascii.
>>
>>I'll try to test and generate i18n patch today.
>
>
>
> I see the point. Unfortunately I only tested English and French and in
> French, _(' at ') translates to ' at '. Here is my suggestion for a
> revised patch (tested with en, es, fr and ja - I can't read the
> Japanese, but it 'looks' OK):
>
> --- f:/Mailman/mailman-2.1.7/Mailman/Archiver/HyperArch.py
> 2005-12-30 10:50:07.000000000 -0800
> +++ f:/test-mailman/Mailman/Archiver/HyperArch.py 2006-01-04
> 18:21:50.750000000 -0800
> @@ -569,16 +569,21 @@
> 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')
> + # MAS: Coerce the body to Unicode and replace any invalid
> characters.
> + langcset = Utils.GetCharSet(self._lang)
> + if not isinstance(body, types.UnicodeType):
> + body = body.decode(langcset, 'replace')
> if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS:
> otrans = i18n.get_translation()
> try:
> i18n.set_language(self._lang)
> body = re.sub(r'([-+,.\w]+)@([-+.\w]+)',
> - '\g<1>' + _(' at ') + '\g<2>', body)
> + '\g<1>' + unicode(_(' at '), langcset)
> + + '\g<2>', body)
> finally:
> i18n.set_translation(otrans)
> + # MAS: Return body to character set of article.
> + body = body.encode(langcset, 'replace')
> return NL.join(headers) % d + '\n\n' + body + '\n'
>
> def _set_date(self, message):
>
--
Tokio Kikuchi, tkikuchi@ is.kochi-u.ac.jp
http://weather.is.kochi-u.ac.jp/
More information about the Mailman-Developers
mailing list