| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Andreas <maps(dot)on(at)gmx(dot)net> |
| Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: invalid byte sequence ? |
| Date: | 2006-08-23 22:45:03 |
| Message-ID: | 25307.1156373103@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-hackers |
Andreas <maps(dot)on(at)gmx(dot)net> writes:
> I've got pg 8.1.4 from the binary Windows installer.
> Windows 2000 / German
> Now I entered "\d" into psql on the text-console and got this:
>
> db_test=# \d
> ERROR: invalid byte sequence for encoding "UTF8": 0xfc6d6572220a
I can replicate this by using a UTF8 database and running the client
in a non-UTF8 locale. For example
$ LANG=de_DE.iso88591 psql postgres
Dies ist psql 8.2devel, das interaktive PostgreSQL-Terminal.
Geben Sie ein: \copyright fr Urheberrechtsinformationen
\h fr Hilfe ber SQL-Anweisungen
\? fr Hilfe ber interne Anweisungen
\g oder Semikolon, um eine Anfrage auszufhren
\q um zu beenden
postgres=# \l
ERROR: invalid byte sequence for encoding "UTF8": 0xfc6d6572222c
TIP: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
postgres=# \d
ERROR: invalid byte sequence for encoding "UTF8": 0xfc6d6572220a
TIP: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
postgres=# \encoding
UTF8
postgres=#
The problem here is that psql is using gettext() to convert column
headings for its display to German, and gettext() sees its locale
as specifying ISO8859-1, so that's the encoding it produces. When
that data is sent over to the server --- which thinks that the
client is using UTF8 encoding, because it hasn't been told any
different --- the server quite naturally barfs.
We've known about this and related issues with gettext for some time,
but a bulletproof solution isn't clear. For the moment all you can
do is be real careful about making your locale settings match up.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2006-08-23 22:47:54 | Re: invalid byte sequence ? |
| Previous Message | Silvela, Jaime (Exchange) | 2006-08-23 22:36:09 | Re: CASCADING could not open relation with OID |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2006-08-23 22:47:54 | Re: invalid byte sequence ? |
| Previous Message | Andreas | 2006-08-23 21:53:22 | Re: invalid byte sequence ? |