[Mailman-Users] Dealing with multiple charsets (list messages and web archive)
Stefan =?utf-8?Q?F=F6rster?=
cite at incertum.net
Sat May 10 22:34:41 CEST 2008
* Mark Sapiro <mark at msapiro.net> wrote:
> Stefan F�rster wrote:
>> # Now join the text and set the payload
>> sep = _('-------------- next part --------------\n')
>> replace_payload_by_text(msg, sep.join(text), charset)
>
> The above problem is a bug fixed in 2.1.10. The fixed code is:
>
> # Now join the text and set the payload
> sep = _('-------------- next part --------------\n')
> # The i18n separator is in the list's charset. Coerce it to the
> # message charset.
> try:
> s = unicode(sep, lcset, 'replace')
> sep = s.encode(charset, 'replace')
> except (UnicodeError, LookupError, ValueError,
> AssertionError):
> pass
> replace_payload_by_text(msg, sep.join(text), charset)
Works like a charm, thanks.
>> Do you think there might be other occurances of wrongly encoded
>> strings read in from the message catalogue or the templates?
>
> Not that I'm aware of.
So, now that I have a temporary fix - how can I recompose a message
and sort the attachments? I don't mind if I have to code this myself,
I would just appreciate a hint on where to start. For now, a single
algorithm like (pseudo code):
,----[ resort message parts ]
| init list_of_text_parts = empty;
| init list_of_NON_text_parts = empty;
| init new_message = empty;
|
| for part in msg.walk();
| if part.get_content_type() <> 'text/plain'
| list_of_NON_text_parts.add(part);
| else
| list_of_text_parts.add(part);
|
| for part in list_of_text_parts.walk();
| message.append(part);
|
| for part in list_of_NON_text_parts.walk()
| message.append(part);
`----
would absolutely be sufficient. I'm just not familiar enough with
Mailman yet to know exactly where to add this code (I don't speak a
single line of Python yet, either, but what I wanna do is not really
rocket science). Anyways, any help you could give me on that subject
would be greatly appreciated.
Ciao
Stefan
--
Stefan F�rster http://www.incertum.net/ Public Key: 0xBBE2A9E9
Heute ist das Gestern von Morgen.
Das heute ist die Geburt von Morgen.
More information about the Mailman-Users
mailing list