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

Rosenbaum, Larry M. rosenbaumlm at ornl.gov
Thu Sep 3 18:14:11 CEST 2009


> From: Mark Sapiro [mailto:mark at msapiro.net]
> Sent: Thursday, September 03, 2009 11:38 AM
> To: Rosenbaum, Larry M.; mailman-users at python.org
> Subject: RE: [Mailman-Users] What causes "decoding Unicode is not
> supported"?
> 
> 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__
> >'4.0.1'
> 
> 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
> FAQ.
> 
> 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.

Thanks.  Upgrading Python to v2.5.1 fixed the problem.


More information about the Mailman-Users mailing list