unicode for beginners

Vlastimil Brom vlastimil.brom at gmail.com
Thu Mar 26 17:37:58 EDT 2009


2009/3/26 WallyDD <shanebest at gmail.com>:
> I have something of a csv file which has somehow been converted into
> something that looks like this;
> " FOZ DE IGUAZ\u00da" and " R\u00cdO DE JANEIRO"
> Is there a simple way to convert this into something a little bit
> readable?
> Is there a simple command in python to convert this?
>
> Thank you.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Hi,
try decoding your output (assuming all non-ascii characters are
escaped this way completely)

>>> " FOZ DE IGUAZ\u00da and R\u00cdO DE JANEIRO".decode("unicode-escape")
u' FOZ DE IGUAZ\xda and R\xcdO DE JANEIRO'
>>> print " FOZ DE IGUAZ\u00da and R\u00cdO DE JANEIRO".decode("unicode-escape")
 FOZ DE IGUAZÚ and RÍO DE JANEIRO
>>>

hth
  vbr



More information about the Python-list mailing list