The Toolkit for Online Communities
18643 Community Members, 0 members online, 2007 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Q&A : Converting SQL_ASCII to UTF-8 in postgres

Forum OpenACS Q&A: Converting SQL_ASCII to UTF-8 in postgres

Icon of envelope Request notifications

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)

Posted by luba novikova on