Re: invalid byte sequence for encoding "UTF8": 0xab

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Grand, Mark D(dot) *EXTERN*" <mgrand(at)emory(dot)edu>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: invalid byte sequence for encoding "UTF8": 0xab
Date: 2009-06-08 09:59:06
Message-ID: D960CB61B694CF459DCFB4B0128514C202FF6634@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mark D. Grand wrote:
> I am having a vexing problem with a script I am writing to
> populate reference tables in a new database.
>
> I am running postgreSQL 8.3 with psql 8.3.7.
>
> Psql reads this SQL statement:
>
> INSERT INTO META_AUTH.DOMAIN_META_ASSERTION (TITLE, DESCRIPTION, META_ASSERTION)
> VALUES ('Super-User Authorization',
> 'This allows a super-user to administer all meta-data.',
> 'UserID «Administer» ()');
>
> and I get this message:
>
> ERROR: invalid byte sequence for encoding "UTF8": 0xab
>
> HINT: This error can also happen if the byte sequence does
> not match the encoding expected by the server, which is
> controlled by "client_encoding".
>
> It is complaining about the '«' character. I do not
> understand why. The database is created the commands
>
> CREATE DATABASE mayyou
> WITH OWNER=meta_auth ENCODING='UTF8';
>
> ALTER DATABASE mayyou SET client_encoding = 'UTF8';
>
> When I give psql the \encoding command, it replies
> UTF8
>
> Why is it complaining about this valid character code?

The database stores characters in UTF-8, and the client
expects UTF-8 characters, but presumably the characters you
feed into psql are not UTF-8.

If this is some kind of UNIX, it might be instructive to
type 'echo "«" | od -t x1' on the command line.

Also knowing the current locale might help to determine the problem.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2009-06-08 10:37:59 Re: Function: Change data while walking through records
Previous Message Albe Laurenz 2009-06-08 09:42:59 Re: PostgreSQL and XA Distributed Transaction Protocol