Re: invalid byte sequence for encoding - Mailing list pgsql-general

From Daniel Schuchardt
Subject Re: invalid byte sequence for encoding
Date
Msg-id 4AAFC664.4050600@prodat-sql.de
Whole thread Raw
In response to Re: invalid byte sequence for encoding  (Scott Ribe <scott_ribe@killerbytes.com>)
Responses Re: invalid byte sequence for encoding
List pgsql-general
Yes, you'r correct with the \0 at the end. The problem is that the
rtf-object returns wrong terminated string. i can fix the problem with a
trim.

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)

Scott Ribe schrieb:
>> So its not possible thats our parser.
>
> And
>
>> Second:string:Not really: thats the orignal string, and its a string:
>
> Look again. Where is the null character in the original string? Why does
> your encoded string end with "\0"? In what character set is null a legal
> character?
>
> Your encoder is incorrect.
>


--
Daniel Schuchardt
/Softwareentwicklung/

/http://www.prodat-sql.de/

pgsql-general by date:

Previous
From: Scott Ribe
Date:
Subject: Re: invalid byte sequence for encoding
Next
From: Christopher Browne
Date:
Subject: Re: postgresql.key secure storage