By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,302 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,302 IT Pros & Developers. It's quick & easy.

convert database to unicode

P: n/a
Hello, I want to convert an existing database with
SQL_ASCII encoding to UNICODE encoding.

(postgresql ver 7.3.2)

I thought that it might be as easy as:
pg_dump mydatabase > dump.sql
createdb --encoding=unicode newdatabase
psql newdatabase < dump.sql

but it wasn't going to be that easy now was it :-(

I'm getting errors such as:
ERROR: copy: line 54, Invalid UNICODE character
sequence found (0xe46765)
lost synchronization with server, resetting connection

Can anyone suggest a way I might be able to do it?
Thanks, David
http://search.yahoo.com.au - Yahoo! Search
- Looking for more? Try the new Yahoo! Search

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
David Lutz wrote:
Hello, I want to convert an existing database with
SQL_ASCII encoding to UNICODE encoding.

(postgresql ver 7.3.2)

I thought that it might be as easy as:
pg_dump mydatabase > dump.sql
createdb --encoding=unicode newdatabase
psql newdatabase < dump.sql

but it wasn't going to be that easy now was it :-(

I'm getting errors such as:
ERROR: copy: line 54, Invalid UNICODE character
sequence found (0xe46765)
lost synchronization with server, resetting connection

Can anyone suggest a way I might be able to do it?
Thanks, David


You *might* be able to convert dump.sql to unicode.

i.e.

iconv -f iso8859-1 -t utf-8 < dump.sql > dump-utf-8.sql

If all the bytea chars are appropriately escaped, this may do it.

Can't harm in giving it a go !



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #2

P: n/a
--- Gianni Mariani <gi****@mariani.ws> wrote: > David
Lutz wrote:
Hello, I want to convert an existing database with
SQL_ASCII encoding to UNICODE encoding.

(postgresql ver 7.3.2)

I thought that it might be as easy as:
pg_dump mydatabase > dump.sql
createdb --encoding=unicode newdatabase
psql newdatabase < dump.sql

You *might* be able to convert dump.sql to unicode.

i.e.

iconv -f iso8859-1 -t utf-8 < dump.sql >
dump-utf-8.sql

If all the bytea chars are appropriately escaped,
this may do it.

Can't harm in giving it a go !


Thanks Gianni, yes that appears to have worked.
I didn't know about the iconv command.

Cheers, David

http://search.yahoo.com.au - Yahoo! Search
- Looking for more? Try the new Yahoo! Search

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.