Re: [UnicodeEncodeError] Don't know what else to try

2008-11-15 Thread Marc 'BlackJack' Rintsch
On Sat, 15 Nov 2008 14:12:42 +0100, Gilles Ganault wrote: > On Fri, 14 Nov 2008 17:39:00 +0100, "Martin v. Löwis" > <[EMAIL PROTECTED]> wrote: >>Can you first please report what happened when you add the print >>statement? > > Thanks guys, I found how to handle this: > > === > for id in

Re: [UnicodeEncodeError] Don't know what else to try

2008-11-15 Thread Gilles Ganault
On Fri, 14 Nov 2008 17:39:00 +0100, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >Can you first please report what happened when you add the print statement? Thanks guys, I found how to handle this: === for id in rows: #Says Unicode, but it's actually not #print type(id[1]

Re: [UnicodeEncodeError] Don't know what else to try

2008-11-14 Thread Martin v. Löwis
Gilles Ganault wrote: > On Fri, 14 Nov 2008 11:01:27 +0100, "Martin v. Löwis" > <[EMAIL PROTECTED]> wrote: >> Add >>print type(output) >> here. If it says "unicode", reconsider the next line >> >>> print output.decode('utf-8') > > In case the string fetc

Re: [UnicodeEncodeError] Don't know what else to try

2008-11-14 Thread Marc 'BlackJack' Rintsch
On Fri, 14 Nov 2008 14:57:42 +0100, Gilles Ganault wrote: > On Fri, 14 Nov 2008 11:01:27 +0100, "Martin v. Löwis" > <[EMAIL PROTECTED]> wrote: >>Add >>print type(output) >>here. If it says "unicode", reconsider the next line >> >>> print output.decode('u

Re: [UnicodeEncodeError] Don't know what else to try

2008-11-14 Thread Gilles Ganault
On Fri, 14 Nov 2008 11:01:27 +0100, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >Add >print type(output) >here. If it says "unicode", reconsider the next line > >> print output.decode('utf-8') In case the string fetched from a web page turns out not to

Re: [UnicodeEncodeError] Don't know what else to try

2008-11-14 Thread Martin v. Löwis
> print output.decode('utf-8') > File "C:\Python25\lib\encodings\utf_8.py", line 16, in decode > return codecs.utf_8_decode(input, errors, True) > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe2' in > position 47: > ordinal not in range(128) Notice that it complains abou

[UnicodeEncodeError] Don't know what else to try

2008-11-14 Thread Gilles Ganault
Hello Data that I download from the web seems to be using different code pages at times, and Python doesn't like this. Google returned a way to handle this, but I'm still getting an error: print output.decode('utf-8') File "C:\Python25\lib\encodings\utf_8.py", line 16, in decode