Mailing List Archive

Unicode - ISO 8859-1 conversion
I have a MySQL database with text in ISO 8859-1. However Plone displays
strings in UTF-8.

I am looking for a function to convert between ISO 8859-1 and unicode.
(I am /not/ looking for a way to change how the strings are stored in
MySQL or how to change the encoding of an entire html page).

Does anyone know of functions that does this. It doesn't matter if it is
done in the MySQL queries, from the Plone API or from the Python API ?

_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db
Re: Unicode - ISO 8859-1 conversion [ In reply to ]
--On 2. Juni 2006 12:08:09 +0200 Jonas Nielsen <jonasn@mail.tele.dk> wrote:

> I have a MySQL database with text in ISO 8859-1. However Plone displays
> strings in UTF-8.
>
> I am looking for a function to convert between ISO 8859-1 and unicode. (I
> am /not/ looking for a way to change how the strings are stored in MySQL
> or how to change the encoding of an entire html page).

Python unicode strings have an encode() Method. For converting to a unicode
string you want to use the unicode() method of Python...the Python doc is
your friend.

-aj

--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376
E-Publishing, Python, Zope & Plone development, Consulting