Need debugging knowhow for my creeping Unicodephobia

kj no.email at please.post
Wed Feb 10 19:50:50 EST 2010


In <Xns9D1BCAD3B50E1duncanbooth at 127.0.0.1> Duncan Booth <duncan.booth at invalid.invalid> writes:

>kj <no.email at please.post> wrote:

>> But to ground
>> the problem a bit I'll say that the exception above happens during
>> the execution of a statement of the form:
>> 
>>   x = '%s %s' % (y, z)
>> 
>> Also, I found that, with the exact same values y and z as above,
>> all of the following statements work perfectly fine:
>> 
>>   x = '%s' % y
>>   x = '%s' % z
>>   print y
>>   print z
>>   print y, z
>> 

>One of y or z is unicode, the other is str.

Yes, that was the root of the problem.

>1. Print the repr of each value so you can see which is which.

Thanks for pointing out repr; it's really useful when dealing with
Unicode headaches.



Thanks for all the replies!

~K



More information about the Python-list mailing list