'ascii' codec can't encode character u'\xf3'

Paul Prescod paul at prescod.net
Tue Aug 17 06:13:00 EDT 2004


Martin Slouf wrote:

> thank you for reply, great info! it helped me to better understand it;
> but of course, some additional questions have risen.
> 
> maybe some of those question/comments may seem stupid (ie. clear), but
> im new to python and i want to assure myself i get it right; thx for
> patience.
> 
> 
>>There is an alternative, if the print is a debug print:
>>
>>- print a repr() of the unicode object instead of
>>  the unicode object itself. This will work on all
>>  terminals, and show hex escapes of non-ASCII characters.
> 
> 
> just to make sure:
> 
> override the object's __repr__(self) method to st. like:

No, he means instead of:

print foo

print repr(foo)

  Paul Prescod




More information about the Python-list mailing list