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

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Ken Johanson <pg-user(at)kensystem(dot)com>
Cc: James Im <im-james(at)hotmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: invalid byte sequence for encoding "UTF8": 0x00
Date: 2007-02-22 08:54:01
Message-ID: 45DD5A29.8020400@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-jdbc

Ken Johanson wrote:

> At least on other servers/drivers I believe nulls are supported (and
> should be according to some spec) (The only special-meaning char is
> single quote).

The driver can't do anything about it, it's a server issue. I can think
of some ways the server could support it without extensive changes ..
e.g. use a "modified UTF8" representation which stores \u0000 as 0xc0
0x80 internally .. but you'd have to take that up with the backend
developers.

> I'm wondering how the binary protocol works insofar as handling the NULL
> byte; does it precede it with a backslash?

The driver sends string parameters out-of-line without escaping (i.e.
length field, then raw utf-8 data). The error you see is generated when
the server notices that there's a \u0000 there; it rejects the string
entirely rather than silently mangling it.

-O

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Doug Knight 2007-02-22 14:24:59 UIDs/GIDs for hacluster and haclient
Previous Message Andy Shellam (Mailing Lists) 2007-02-22 08:43:13 Re: [pgadmin-support] UNSUBSCRIBE

Browse pgsql-jdbc by date

  From Date Subject
Next Message Heikki Linnakangas 2007-02-22 10:58:03 Re: Class Cast Exception for DataSource
Previous Message Ken Johanson 2007-02-22 06:37:51 Re: invalid byte sequence for encoding "UTF8": 0x00