UNICODE-encoded database does not accept umlaut-characters.

Started by Erwin Brandstetterabout 22 years ago3 messagesgeneral
Jump to latest

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.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Erwin Brandstetter (#1)
Re: UNICODE-encoded database does not accept umlaut-characters.

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

#3Noname
Brsa@gmx.at
In reply to: Erwin Brandstetter (#1)
Re: UNICODE-encoded database does not accept umlaut-characters (solved)

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