jueves, 30 de julio de 2009

PostgreSQL Encoding

If you have an old postgres database that is still stored in SQL_ASCII and you want to move to one stored in UTF-8 (which is the standard for OpenACS), you can do the following:

- pg_dump -f your_db.dmp your_db
- iconv -f ISO8859-1 -t UTF-8 your_db.dmp > utf.dmp
- psql your_utf_db < utf.dmp

This assumes, that SQL_ASCII has been storing the content in ISO8859-1, which is a safe bet if you are in the US or western Europe. But don't nail me on that, if it does not work, try different source character sets (manual for iconv: http://www.mkssoftware.com/docs/man1/iconv.1.asp)