[Mailman-i18n] charset anoyance

Barry Warsaw barry at python.org
Sun Nov 30 17:04:59 EST 2003

On Wed, 2003-10-29 at 17:27, Martin v. Löwis wrote:

> If you want to add it, please look at Mailman/Handlers/Decorate.py.
> The test
>     if not msg.is_multipart() and msgtype == 'text/plain' and \
>            msg.get('content-transfer-encoding', '').lower() <> 'base64' and \
>            (lcset == 'us-ascii' or mcset == lcset):
> is the one that allows direct concatenation of the header. You could
> extend this to recode the header into the message charset.

Are Latin 1 and Latin 9 essentially compatible?  Would something like
the following work:

def compatible(mcset, lcset):
    # If the list's preferred charset is us-ascii, we can always safely add
    # the header/footer to a plain text message since all email charsets
    # Mailman supports are strict supersets of us-ascii -- no, UTF-16 emails
    # are not supported.
    if lcset == 'us-ascii':
        return True
    if mcset == lcset:
        return True
    # Latin 1 and Latin 9 are basically compatible
    if lcset in LATIN_1_15 and mcset in LATIN_1_15:
        return True
    # For now, nothing else is compatible.
    return False

...and then replace the last conditional in the above with:
compatible(mcset, lcset)


More information about the Mailman-i18n mailing list