>>>>> <[EMAIL PROTECTED]> (DR) wrote: >DR> How can I convert a string read from a database containing unicode >literals, such as "Fr\u00f8ya" to the latin-1 equivalent, "Frøya"? >DR> I have tried variations around >DR> "Fr\u00f8ya".decode('latin-1') >DR> but to no avail.
You have to use encode instead of decode, and the input string must be a unicode string. >>> print u"Fr\u00f8ya".encode('latin-1') Frøya >>> -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list