Re: v8.3 + UTF8 errors when restoring DB - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: v8.3 + UTF8 errors when restoring DB
Date
Msg-id 20080310122552.GA4469@alvh.no-ip.org
Whole thread Raw
In response to v8.3 + UTF8 errors when restoring DB  ("Mitchell D. Russell" <mitchell.russell@gmail.com>)
List pgsql-general
Mitchell D. Russell escribió:

> I did a PG_dump of the database tonight, and went to restore it to my newly
> created database (WIN2152 encoding), which worked fine, but when I go to
> retrieve the data via my code (.NET c#), I get errors like :
>
> character 0x8f of encoding "WIN1252" has no equivalent in "UTF8"
> character 0x81 of encoding "WIN1252" has no equivalent in "UTF8"
> character 0x9d of encoding "WIN1252" has no equivalent in "UTF8"

The problem is that your data is invalid, according to Wikipedia:

    According to the information on Microsoft's and the Unicode
    Consortium's websites, positions 81, 8D, 8F, 90, and 9D are
    unused.

So obviously they cannot be converted into any other encoding.

See the table of Win-1252 chars here:
http://en.wikipedia.org/wiki/Windows-1252

Most likely, your source data is not Win1252 but some other different
encoding, so the pg_dump/pg_restore into a Win1252 database mangled it.
Perhaps you oughta initdb the new database with the same encoding that
the original database had, or declare the client_encoding on the
pg_restore step.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: Reid Thompson
Date:
Subject: Re: loading a psql input file on win xp
Next
From: Raymond O'Donnell
Date:
Subject: Re: loading a psql input file on win xp