Re: invalid byte sequence for encoding

From: Daniel Schuchardt <d(dot)schuchardt(at)prodat-sql(dot)de>
To: pgsql-general(at)postgresql(dot)org
Cc: Scott Ribe <scott_ribe(at)killerbytes(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Thomas Kellerer <spam_eater(at)gmx(dot)net>
Subject: Re: invalid byte sequence for encoding
Date: 2009-09-15 16:52:52
Message-ID: 4AAFC664.4050600@prodat-sql.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2009-09-15 17:36:45 Re: postgresql.key secure storage
Previous Message Scott Ribe 2009-09-15 16:46:42 Re: invalid byte sequence for encoding