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

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: invalid byte sequence for encoding "UTF8": 0x00
Дата
Msg-id 45DD5A29.8020400@opencloud.com
обсуждение исходный текст
Ответ на Re: invalid byte sequence for encoding "UTF8": 0x00  (Ken Johanson <pg-user@kensystem.com>)
Список 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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Ken Johanson
Дата:
Сообщение: Re: invalid byte sequence for encoding "UTF8": 0x00
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Class Cast Exception for DataSource