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

From: Ken Johanson <pg-user(at)kensystem(dot)com>
To: Oliver Jowett <oliver(at)opencloud(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 06:37:51
Message-ID: 45DD3A3F.5050609@kensystem.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-jdbc

Oliver Jowett wrote:
> James Im wrote:
>
>> I've got another problem. I sometimes get the following SQLException
>> when doing an insert:
>>
>> ERROR: invalid byte sequence for encoding "UTF8": 0x00
>
> You're trying to insert a string which contains a '\0' character. The
> server can't handle strings containing embedded NULs, as it uses C-style
> string termination internally.
>

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).

I'm wondering how the binary protocol works insofar as handling the NULL
byte; does it precede it with a backslash? I'm wondering if this would
be possible for the String conversion as well -- just for sake of
consistency with other DBs (and since some API inevitable expect users
to send binary data through a char-sequence interface)

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Anna Żak 2007-02-22 06:42:25 unsubscribe
Previous Message Ankit Mehrotra 2007-02-22 06:25:23 unsubscribe

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2007-02-22 08:54:01 Re: invalid byte sequence for encoding "UTF8": 0x00
Previous Message Raghavendra MB 2007-02-22 06:20:01 Class Cast Exception for DataSource