encoding problem

Sebastjan Trepca trepca at gmail.com
Fri Mar 3 12:54:39 CET 2006

I think you are trying to concatenate a unicode string with regular
one so when it tries to convert the regular string to unicode with
ASCII(default one) encoding it fails. First find out which of these
strings is regular and how it was encoded, then you can decode it like
this(if regular string is diff):

mailbody +=diff.decode('<correct encoding>')


On 3/3/06, Yves Glodt <y.glodt at sitasoftware.lu> wrote:
> Hi list,
> Playing with the great pysvn I get this problem:
> Traceback (most recent call last):
>    File "D:\avn\mail.py", line 80, in ?
>      mailbody += diff
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position
> 10710: ordinal not in range(128)
> It seems the pysvn.client.diff function returns "bytes" (as I read in
> the changelog of pysvn: http://svn.haxx.se/dev/archive-2005-10/0466.shtml)
> How can I convert this string so that I can contatenate it to my
> "regular" string?
> Best regards,
> Yves
> --
> http://mail.python.org/mailman/listinfo/python-list

More information about the Python-list mailing list