encoding problem

Yves Glodt y.glodt at sitasoftware.lu
Thu Mar 9 02:58:45 EST 2006


Sebastjan Trepca wrote:
> 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>')

Thanks I'll look into that...

It seems in general I have trouble with special characters...
What is the python way to deal with éàè öäü etc...

print 'é' fails here,
print u'é' as well :-(

How am I supposed to print non-ascii characters the correct way?


best regards,
Yves

> Sebastjan
> 
> 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



More information about the Python-list mailing list