21 Sep 11:32
Re: Convert Text to UTF-8?
> I'm not sure I understand what is happening because you didn't mention
> the encoding of the source data, but when migrating an old ISO8859-1
> (mysql) database to UTF-8 (pgsql) for use with Zope, I wrote a python
> script that converted the dump file before reloading it as UTF8. It
> wasn't a perfect way of doing it, but it worked and Zope/psycopg worked
> with UTF8 fine after that.
Thank you Nick! A very simple and effective solution.
Not only was I able to convert my data into utf-8 from latin-1 (into a
pgsql db) but I was finally able to identify the python snippet that
would allow me to convert to utf-8 on the fly.
For anyone else finding this,
in python use: unicode(YOURTTEXT,'latin-1').encode('utf-8')
in dtml use: <dtml-var expr="unicode(YOURTTEXT,'latin-1').encode('utf-8')">
Cheers,
Duane
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
RSS Feed