Re: invalid byte sequence for encoding

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: invalid byte sequence for encoding
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C203937F18@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на Re: invalid byte sequence for encoding  (Daniel Schuchardt <d.schuchardt@prodat-sql.de>)
Список pgsql-general
Daniel Schuchardt wrote:
> but look here:
>
> XXXXX=# UPDATE art SET ak_auftxt= '*', ak_auftxt_rtf=
> '{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0
> Arial;}}\r\n\\viewkind4\\uc1\\pard\\lang1031\\fs20 *
> \r\n\\par }\r\n\0' WHERE ak_nr='TEST';
> WARNING:  nonstandard use of \\ in a string literal at character 47
> HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
> ERROR:  invalid byte sequence for encoding "SQL_ASCII": 0x00
> 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".
> XXXX=# SELECT version();
>                             version
> -------------------------------------------------------------
>   PostgreSQL 8.4.1, compiled by Visual C++ build 1400, 32-bit
>
> ##############################################################
>
> XXXX=# UPDATE art SET ak_auftxt= '*', ak_auftxt_rtf=
> '{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0
> Arial;}}\r\n\\viewkind4\\uc1\\pard\\lang1031\\fs20 *\
> r\n\\par }\r\n\0' WHERE ak_nr='TEST';
> UPDATE 1
> XXXX=# SELECT version();
>                                                      version
> --------------------------------------------------------------
>   PostgreSQL 8.1.11 on i486-pc-linux-gnu, compiled by GCC cc
> (GCC) 4.1.2
> 20061115
>   (prerelease) (Debian 4.1.1-21)
> (1 row)

PostgreSQL's encoding checks have become more airtight over the
versions, so it is no surprise that buggy behaviour in 8.1
has changed by 8.4.

The zero character at the end of your string has been wrong all
along, only the old version does not complain.

You probably never noticed the string truncation because the
zero character is the last one.

You'll need to fix your program so that it does not emit trailing
zero characters.

Yours,
Laurenz Albe

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

Предыдущее
От: Ed Koch
Дата:
Сообщение: Re: I need a Postgres Admin $130K + 20K in NYC Any Ideas?
Следующее
От: "Ow Mun Heng"
Дата:
Сообщение: Re: hardware information