On 2009-03-13, Johannes Bauer wrote:
> Peter Otten schrieb:
>
>> encoding = sys.stdout.encoding or "ascii"
>> for row in rows:
>> id, address = row[:2]
>> print id, address.encode(encoding, "replace")
>>
>> Example:
>>
> u"ähnlich lölich üblich".encode("ascii", "replace")
>> '?hnlich
On Fri, 13 Mar 2009 14:24:52 +0100, Peter Otten <__pete...@web.de>
wrote:
>It seems the database gives you the strings as unicode. When a unicode
>string is printed python tries to encode it using sys.stdout.encoding
>before writing it to stdout. As you run your script on the windows commmand
>line
Peter Otten schrieb:
> encoding = sys.stdout.encoding or "ascii"
> for row in rows:
> id, address = row[:2]
> print id, address.encode(encoding, "replace")
>
> Example:
>
u"ähnlich lölich üblich".encode("ascii", "replace")
> '?hnlich l?lich ?blich'
A very good tip, Peter - I've als
Gilles Ganault wrote:
> I must be dense, but I still don't understand 1) why Python sometimes
> barfs out this type of error when displaying text that might not be
> Unicode-encoded, 2) whether I should use encode() or decode() to solve
> the issue, or even 3) if this is a Python issue or due to A
Hello
I must be dense, but I still don't understand 1) why Python sometimes
barfs out this type of error when displaying text that might not be
Unicode-encoded, 2) whether I should use encode() or decode() to solve
the issue, or even 3) if this is a Python issue or due to APWS SQLite
wrapper that