Re: Change server encoding after the fact - Mailing list pgsql-general

From Cody Caughlan
Subject Re: Change server encoding after the fact
Date
Msg-id CAPVp=gY6yDDsfz7DfGiXJ2oCHgmHSAtJD=ZtDHAaHj1qm1uZCA@mail.gmail.com
Whole thread Raw
In response to Re: Change server encoding after the fact  (Scott Marlowe <scott.marlowe@gmail.com>)
Responses Re: Change server encoding after the fact  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
Please see below.

On Fri, Sep 30, 2011 at 1:12 PM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
On Fri, Sep 30, 2011 at 1:45 PM, Cody Caughlan <toolbag@gmail.com> wrote:
> That worked, but "file" shows no difference:
> $ iconv -f utf-8 -t utf-8 -c foo.sql > utf.sql
> $ file -i foo.sql
> foo.sql: text/plain; charset=us-ascii
> $file -i utf.sql
> utf.sql: text/plain; charset=us-ascii
> So iconv didnt actually convert the file OR does is the "file" command just
> ignorant?

Not sure.  try loading the dump into the UTF-8 DB in postgres and see
what happens I guess?


Uh oh.

On the remote machine:

$ pg_dump -Fc -E UTF8 foo > foo.sql

Then I've created a new local DB with UTF8 encoding and I try to restore this dump into it:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 2342; 0 17086 TABLE DATA wine_books vinosmith
pg_restore: [archiver (db)] COPY failed for table "wine_books": ERROR:  invalid byte sequence for encoding "UTF8": 0xc309
CONTEXT:  COPY wine_books, line 1147
WARNING: errors ignored on restore: 1

And sure enough the table "wine_books" is empty. Not good.

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Change server encoding after the fact
Next
From: Scott Marlowe
Date:
Subject: Re: Change server encoding after the fact