handling unicode data

Filipe fcorreia at gmail.com
Wed Jun 28 13:06:45 EDT 2006


Hi Fredrik,

Thanks for the reply.
Instead of:
    term = row[1]
I tried:
    term = unicode(row[1], "iso-8859-1")

but the following error was returned when printing "term":
Traceback (most recent call last):
  File "test.py", line 11, in ?
    print term
  File "c:\Program Files\Python24\lib\encodings\cp437.py", line 18, in
encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\xd8' in
position 31: character maps to <undefined>

Is it possible some unicode strings are not printable to the console?
It's odd, because I can manually write in the console the same string
I'm trying to print.
I also tried other encodings, besides iso-8859-1, but got the same
error.

Do you think this has something to do with the DB-API driver? I don't
even know where to start if I have to change something in there :|

Cheers,
Filipe




More information about the Python-list mailing list