Re: BUG #4679: invalid UTF-8 byte sequence detected near byte 0xa3 + postgresql

Lists: pgsql-bugs
From: "Bhajesh" <bbhajesh(at)zeomega(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4679: invalid UTF-8 byte sequence detected near byte 0xa3 + postgresql
Date: 2009-02-27 10:06:13
Message-ID: 200902271006.n1RA6DMa052699@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4679
Logged by: Bhajesh
Email address: bbhajesh(at)zeomega(dot)com
PostgreSQL version: 8.1
Operating system: red hat linux 9
Description: invalid UTF-8 byte sequence detected near byte 0xa3 +
postgresql
Details:

Hi

My previous server database encoding was SQL_ASCII.i took the backup in
UTF8 encoding.when i was going to restore the backup in new server whose
encoding is UTF-8 it is throwing some error like "invalid UTF-8 byte
sequence detected near byte 0xa3".When i tried to restore same server then
also it is showing same error.I don't know why it is happening please help
me.


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Bhajesh <bbhajesh(at)zeomega(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4679: invalid UTF-8 byte sequence detected near byte 0xa3 + postgresql
Date: 2009-02-27 15:10:45
Message-ID: 49A80275.4020308@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Bhajesh wrote:
> My previous server database encoding was SQL_ASCII.i took the backup in
> UTF8 encoding.when i was going to restore the backup in new server whose
> encoding is UTF-8 it is throwing some error like "invalid UTF-8 byte
> sequence detected near byte 0xa3".When i tried to restore same server then
> also it is showing same error.I don't know why it is happening please help
> me.

What commands exactly did you use to take the backup and to restore it?

It seems that even though you specified SQL_ASCII as the encoding in the
old database, you nevertheless stored non-ASCII characters in it. You
need to know what encoding was used to store them. Once you know that,
you can edit the backup dump (assuming you used pg_dump), and modify the
line that says "SET client_encoding = ..." to the correct encoding. You
can also use the iconv program to convert the dump from one encoding to
another.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com