Thread: Changing encoding

Changing encoding

From
Carol Walter
Date:
Hello,

I have some databases that use SQL ASCII or Latin1 encoding that need
to be UTF8.  When I have drop the database and recreated it with the
correct encoding I get errors in restoring the data.  How is this done?

Carol

Re: Changing encoding

From
Peter Eisentraut
Date:
Am Dienstag, 15. Juli 2008 schrieb Carol Walter:
> I have some databases that use SQL ASCII or Latin1 encoding that need
> to be UTF8.  When I have drop the database and recreated it with the
> correct encoding I get errors in restoring the data.  How is this done?

What is your PostgreSQL version?  What is the exact command sequence?

The sort of problem you describe is usually fixed by setting the client
encoding correctly, but recent versions should do this automatically for
dumps/restores.

Re: Changing encoding

From
Carol Walter
Date:
I'm at 8.2.3
I do a data only pg_dump. I drop the database, then recreate it with
the correct encoding.  Then load the data back in with psql.

Carol

On Jul 15, 2008, at 11:04 AM, Peter Eisentraut wrote:

> Am Dienstag, 15. Juli 2008 schrieb Carol Walter:
>> I have some databases that use SQL ASCII or Latin1 encoding that need
>> to be UTF8.  When I have drop the database and recreated it with the
>> correct encoding I get errors in restoring the data.  How is this
>> done?
>
> What is your PostgreSQL version?  What is the exact command sequence?
>
> The sort of problem you describe is usually fixed by setting the
> client
> encoding correctly, but recent versions should do this
> automatically for
> dumps/restores.


Re: Changing encoding

From
Ivo Rossacher
Date:
For the SQL_ASCII tables it depends what was actually written to the tables.
SQL_ASCII means that the server does not do any conversation and that the
client is responsible for the used encoding. So if there is data in the table
with different encodings (comming from different clients with different
encodings) you need to fix this by hand (depending on the data size an
editor, iconv, recode or similar might help you with this).
The Latin1 tables might be fixed by iconv or be autodetected by the server.

You can find details about the subject in the chapter 21.2 Character Set
Support of the server documentation.

Best regards
Ivo

Am Dienstag, 15. Juli 2008 16:14:25 schrieb Carol Walter:
> Hello,
>
> I have some databases that use SQL ASCII or Latin1 encoding that need
> to be UTF8.  When I have drop the database and recreated it with the
> correct encoding I get errors in restoring the data.  How is this done?
>
> Carol