Re: invalid byte sequence ?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andreas <maps(dot)on(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: invalid byte sequence ?
Date: 2006-08-23 22:47:54
Message-ID: 200608232247.k7NMls528659@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


Is this a TODO?

---------------------------------------------------------------------------

Tom Lane wrote:
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bob Pawley 2006-08-23 22:51:45 Re: Inserting Data
Previous Message Tom Lane 2006-08-23 22:45:03 Re: invalid byte sequence ?

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-23 22:52:00 Re: invalid byte sequence ?
Previous Message Tom Lane 2006-08-23 22:45:03 Re: invalid byte sequence ?