Thread: UNICODE-encoded database does not accept umlaut-characters.

UNICODE-encoded database does not accept umlaut-characters.

From
Erwin Brandstetter
Date:
Created a new 7.4 database.
# create database foo with encoding = UNICODE;
Then tried to restore my dump from pg 7.2 which was SQL-ASCII or Latin1
encoded (cant tell which of the two, only got the dump of the old database
left after upgrading postgresql.)
Succeeded creating the objects, but no data was restored, instead
postgresql complained about illegal UNICODE characters. Also export of an
MS-Access Database with pgAdmin 1.6 failed with the same errors.

Created a new database with encoding = Latin1. Everything worked fine.

This is a shame, as UNICODE was chosen to avoid future problems with exotic
characters. But I cant get it working because of this very problem!

Is this a bug? Any workarounds?

Regards & TIA
Erwin

--
no z in my mail.

Re: UNICODE-encoded database does not accept umlaut-characters.

From
Tom Lane
Date:
Erwin Brandstetter <Brsaz@gmzx.at> writes:
> Created a new 7.4 database.
> # create database foo with encoding = UNICODE;
> Then tried to restore my dump from pg 7.2 which was SQL-ASCII or Latin1
> encoded (cant tell which of the two, only got the dump of the old database
> left after upgrading postgresql.)
> Succeeded creating the objects, but no data was restored, instead
> postgresql complained about illegal UNICODE characters.

Yeah; by default PG will assume that you are sending it UNICODE data
if that's what the database encoding is.

You can arrange for conversion to occur by adding
    set client_encoding = latin1;
at the top of the dump file.

            regards, tom lane

Re: UNICODE-encoded database does not accept umlaut-characters (solved)

From
Brsa@gmx.at (Erwin Brandstetter)
Date:
Erwin Brandstetter (myself) wrote in message
> First, thanx for the hint! Tried it, but no success. Here is what I did:
(...)

After facing various problems with my installation of postgresql 7.4 I
decided to do a complete re-install (got strange errors when trying to
vacuum, for one).
Now, that finally everything is up and running again, I tried it again
the way Tom has pointed out to me, and .. voilá: it works. Goes off
without a hitch.

One hint, if u should be in a similar situation: Don't forget to set
client_encoding = Latin1 (or whatever is appropriate) for any client
client that does not make use of UNICODE.

Thanks once more to Tom & regards!
Erwin Brandstetter