Connecting Tech Pros Worldwide Help | Site Map

convert database to unicode

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 11th, 2005, 10:30 PM
David Lutz
Guest
 
Posts: n/a
Default convert database to unicode

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 majordomo@postgresql.org)


  #2  
Old November 11th, 2005, 10:30 PM
Gianni Mariani
Guest
 
Posts: n/a
Default Re: convert database to unicode

David Lutz wrote:
[color=blue]
>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
>[/color]

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

  #3  
Old November 11th, 2005, 10:30 PM
David Lutz
Guest
 
Posts: n/a
Default Re: convert database to unicode

--- Gianni Mariani <gianni@mariani.ws> wrote: > David
Lutz wrote:[color=blue]
>[color=green]
> >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
> >[/color]
> 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 ![/color]

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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.