Wednesday, March 2, 2011

Converting to UTF8

Hi,

I have a postgres database that is LATIN1. It contains extended
characters, for example Harry Størksen.

I dumped this out to a file:

pg_dump -U dbuser db > db.sql

and then ran iconv

iconv --from-code latin1 --to-code utf-8 db.sql > db-utf8.sql

and then imported into a database which has utf8 encoding

db_utf8=> \i db-utf8.sql

If I query this data inside the psql prompt, it works:

db_utf8=> select name from app_table where slug = 'harry-strksen';
name
-----------------
Harry Størksen

However, my web page now gets Harry Størksen instead.

Switching back to the LATIN1 database, all is fine.

Does anyone have any clues as to why this doesn't work and what I can do
to fix it?

Cheers,

Tim.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment