Re: UnicodeDecodeError

Werner Fleck <[email protected]>
Newsgroups gmane.mail.spam.tmda.user
Message-ID <[email protected]>
I might have found a fix for the problem, but be aware that this is my
first try at programming python :-)

The error seems to be caused by the string operation in the line

    return "(%s) %s" % (CharSet,
      TranslateToUTF8(PVars[("General", "CSEncoding")], Str, Errors))

When I replace this with

    return TranslateToUTF8(PVars[("General", "CSEncoding")],
      "(%s) %s" % (CharSet, unicode(Str, "latin1")),
      Errors)

everything works fine for me.

I've attached a diff to this message.

Werner

Werner Fleck schrieb:
> Today I've got a UnicodeDecodeError error while using tmda.cgi.
> 
> I have attached the complete error message and the email which caused
> the error.
> 
> Regards
> Werner
>
Unicode.py.diff.zip (application/x-zip-compressed, 448 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.