Re: How to restore a SQL-ASCII encoded database to a new UTF-8 db?

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Postgres User *EXTERN*" <postgres(dot)developer(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to restore a SQL-ASCII encoded database to a new UTF-8 db?
Date: 2009-05-22 06:47:42
Message-ID: D960CB61B694CF459DCFB4B0128514C202FF65E2@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I have a database that was created with SQL-ASCII encoding
> (unfortunately). I ran pg_restore to load the struct and data into a
> new database with UTF-8 encoding but no surprise- I'm seeing this
> error for a number of tables:
>
> pg_restore: [archiver (db)] COPY failed: ERROR: invalid byte
> sequence for encod
> ing "UTF8"
>
> Any idea on how I can copy the data between these databases without
> any data loss? For some reason I thought that a conversion to Unicode
> would be easy.

Conversion to Unicode is easy if you know the encoding of your data
and that is consistent :^)

Try to figure out the encoding of your data.

Then dump in text format and change the "SET client_encoding"
line in the dump accordingly.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tommy Gildseth 2009-05-22 07:09:32 Re: How to restore a SQL-ASCII encoded database to a new UTF-8 db?
Previous Message Scott Bailey 2009-05-22 06:40:10 Re: referring to calculated column in sub select