Search Postgresql Archives

Re: invalid byte sequence for encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux