Unicode literals to latin-1

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Jan 30 10:48:23 CET 2008

On Wed, 30 Jan 2008 09:57:55 +0100, David.Reksten wrote:

> How can I convert a string read from a database containing unicode
> literals, such as "Fr\u00f8ya" to the latin-1 equivalent, "Frøya"?
> I have tried variations around
>   "Fr\u00f8ya".decode('latin-1')
> but to no avail.

In [388]: 'Fr\u00f8ya'.decode('unicode-escape')
Out[388]: u'Fr\xf8ya'

In [389]: print 'Fr\u00f8ya'.decode('unicode-escape')

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list