[Mailman-Users] What causes "decoding Unicode is not supported"?

Mark Sapiro mark at msapiro.net
Thu Sep 3 17:37:50 CEST 2009

Rosenbaum, Larry M. wrote:
>ornl71# python
>Python 2.5 (r25:51908, Sep 20 2006, 06:18:53)
>[GCC 3.4.6] on sunos5
>Type "help", "copyright", "credits" or "license" for more information.
>>>> import email
>>>> email.__version__

I don't know if there was a different email 4.0.1 distributed with
Python 2.5 as opposed to Python 2.5.1, or if yours is modified by Sun
in some way (if it is a Sun package), but the problem is in your
email/message.py get_content_charset method.

All the email 4.0.x versions I have define this method as in the
attached message.get_content_charset.txt file.

In your case, the statement

    charset = unicode(charset, 'us-ascii').encode('us-ascii')

is attempting to convert charset to unicode without first testing if it
is already a unicode, which it is in the problem case.

It appears there may be an additional incompatibility between Mailman
2.1.12 and Python 2.5 as opposed to Python 2.5.x. I'll not this in the

If you can easily upgrade to a later Python 2.5.x, I think that will
solve the problem. If not, you could patch
/usr/local/lib/python2.5/email/message.py by replacing the definition
of get_content_charset with that in the attached file.

Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: message.get_content_charset.txt
URL: <http://mail.python.org/pipermail/mailman-users/attachments/20090903/88cc82b9/attachment.txt>

More information about the Mailman-Users mailing list