Re: ascii to utf-8 - Mailing list pgsql-general

From Tom Hart
Subject Re: ascii to utf-8
Date
Msg-id 4797BAE3.30907@coopfed.org
Whole thread Raw
In response to Re: ascii to utf-8  (Tommy Gildseth <tommy.gildseth@usit.uio.no>)
Responses Re: ascii to utf-8
Re: ascii to utf-8
List pgsql-general
Tommy Gildseth wrote:
> Tom Hart wrote:
>> Hello everybody. I hope your week's going well so far.
>>
>> I built our data mine in postgreSQL around 3 months ago and I've been
>> working with it since. Postgres is great and I'm really enjoying it,
>> but I've hit a bit of a hitch. Originally (and against pgAdmin's good
>> advice, duh!) I set up the database to use ASCII encoding. However we
>> have a large base of Spanish speaking members and services, and we
>> need utf-8
> ...snip snip
>>
>> pg_restore: [archiver (db)] COPY failed: ERROR:  invalid byte
>> sequence for encoding "UTF8": 0xc52f
>> HINT:  This error can also happen if the byte sequence does not match
>> the encoding expected by the server, which is controlled by
>> "client_encoding".
>> CONTEXT:  COPY transaction, line 209487
>> WARNING: errors ignored on restore: 1
>>
>
> Try editing your dump-file and change the line which reads "SET
> client_encoding = 'SQL_ASCII';" to "SET client_encoding = 'LATIN1';"
>
I tried making the changes you specified with notepad, wordpad, gVim,
vim and emacs and in each case pgAdmin (and pg_restore) complain about
the dump header being corrupted. This has been kind of a pain since the
file is ~ 65mb and it's difficult to load something that size into a
text editor. I also did a head > file, edited the file, and then did
head -n -10 >> file, but once again I had no success. Is there an easy
way of doing this, or perhaps a different way of solving the problem?

--
Tom Hart
IT Specialist
Cooperative Federal
723 Westcott St.
Syracuse, NY 13210
(315) 471-1116 ext. 202
(315) 476-0567 (fax)


pgsql-general by date:

Previous
From: Simon Riggs
Date:
Subject: Re: pg_xlog and standby
Next
From: pepone.onrez
Date:
Subject: Re: Best practices for protect applications agains Sql injection.