Re: invalid byte sequence for encoding "UTF8": 0x00 - Mailing list pgsql-jdbc

From Ken Johanson
Subject Re: invalid byte sequence for encoding "UTF8": 0x00
Date
Msg-id 45DD3A3F.5050609@kensystem.com
Whole thread Raw
In response to Re: invalid byte sequence for encoding "UTF8": 0x00  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: invalid byte sequence for encoding "UTF8": 0x00
Re: invalid byte sequence for encoding "UTF8": 0x00
List 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)



pgsql-jdbc by date:

Previous
From: "Raghavendra MB"
Date:
Subject: Class Cast Exception for DataSource
Next
From: Oliver Jowett
Date:
Subject: Re: invalid byte sequence for encoding "UTF8": 0x00