handling unicode data
fredrik at pythonware.com
Wed Jun 28 19:16:28 CEST 2006
> Thanks for the reply.
> Instead of:
> term = row
> I tried:
> term = unicode(row, "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
> return codecs.charmap_encode(input,errors,encoding_map)
> UnicodeEncodeError: 'charmap' codec can't encode character u'\xd8' in
> position 31: character maps to <undefined>
works for me, given your example:
>>> s = "Fran\xd8a"
>>> unicode(s, "iso-8859-1")
print in this case ?
More information about the Python-list