Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 060199FB671 for ; Thu, 22 Feb 2007 02:38:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 96438-06 for ; Thu, 22 Feb 2007 02:38:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from www01.kensystem.com (www01.kensystem.com [72.19.170.120]) by postgresql.org (Postfix) with ESMTP id ED2BE9FBC95 for ; Thu, 22 Feb 2007 02:38:01 -0400 (AST) Received: from 192.168.0.3 by www01.kensystem.com (SMTPD); id s20070222063751.22918; Thu, 22 Feb 2007 06:37:51 Message-ID: <45DD3A3F.5050609@kensystem.com> Date: Wed, 21 Feb 2007 23:37:51 -0700 From: Ken Johanson User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Oliver Jowett CC: James Im , pgsql-jdbc@postgresql.org Subject: Re: invalid byte sequence for encoding "UTF8": 0x00 References: <45DAE076.1060407@opencloud.com> In-Reply-To: <45DAE076.1060407@opencloud.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=BAYES_50, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200702/116 X-Sequence-Number: 16672 Oliver Jowett wrote: > James Im wrote: > >> I've got another problem. I sometimes get the following SQLException >> when doing an insert: >> >> ERROR: invalid byte sequence for encoding "UTF8": 0x00 > > You're trying to insert a string which contains a '\0' character. The > server can't handle strings containing embedded NULs, as it uses C-style > string termination internally. > 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). I'm wondering how the binary protocol works insofar as handling the NULL byte; does it precede it with a backslash? I'm wondering if this would be possible for the String conversion as well -- just for sake of consistency with other DBs (and since some API inevitable expect users to send binary data through a char-sequence interface)