Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id DF07C9FB47F for ; Tue, 20 Feb 2007 08:07:25 -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 94089-07 for ; Tue, 20 Feb 2007 08:07:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail3.ecircle.de (mail3.ecircle.de [195.140.186.206]) by postgresql.org (Postfix) with ESMTP id E2C299FB46A for ; Tue, 20 Feb 2007 08:07:18 -0400 (AST) Received: from einstein.muc.ecircle.de (einstein.muc.ecircle.de [192.168.1.7]) by mail3.ecircle.de (READY) with ESMTP id 834F61A55D3; Tue, 20 Feb 2007 12:13:39 +0100 (CET) Received: from [192.168.1.91] ([192.168.1.91]) by einstein.muc.ecircle.de with Microsoft SMTPSVC(6.0.3790.1830); Tue, 20 Feb 2007 12:13:39 +0100 Subject: Re: invalid byte sequence for encoding "UTF8": 0x00 From: Csaba Nagy To: Altaf Malik Cc: James Im , Postgres JDBC In-Reply-To: <793207.12351.qm@web39108.mail.mud.yahoo.com> References: <793207.12351.qm@web39108.mail.mud.yahoo.com> Content-Type: text/plain; charset=UTF-8 Message-Id: <1171970019.3101.328.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 20 Feb 2007 12:13:39 +0100 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 20 Feb 2007 11:13:39.0481 (UTC) FILETIME=[2C3AD890:01C754E0] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.063 tagged_above=0 required=5 tests=AWL, BAYES_50, SPF_PASS X-Spam-Level: X-Archive-Number: 200702/108 X-Sequence-Number: 16664 I've had the same error, and it is in fact because in Java you can actually have a "0x0" character in your string, and that's valid unicode. So that's translated to the character 0x0 in UTF8, which in turn is not accepted because the server uses null terminated strings... so the only way is to make sure your strings don't contain the character '\u0000'. I identified the place in my code which was generating such a character and fixed, and I didn't have other problems after that... even if I still think forbidding a valid character is a somewhat arbitrary restriction. HTH, Csaba. On Tue, 2007-02-20 at 11:57, Altaf Malik wrote: > Try to change the encoding of your database to "Unicode".=20 > I hope this helps. > =20 > --Altaf Malik > EnterpriseDB > www.enterprisedb.com > James Im wrote: > Hi, > =20 > I've got another problem. I sometimes get the following > SQLException > when doing an insert: > =20 > ERROR: invalid byte sequence for encoding "UTF8": 0x00 > Exception: org.postgresql.util.PSQLException > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(Que= ryExecutorImpl.java:1525) > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExec= utorImpl.java:1309) > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImp= l.java:188) > org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2= Statement.java:452) > org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(Abst= ractJdbc2Statement.java:354) > org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(Abstrac= tJdbc2Statement.java:308) > =20 > By the way, the insert is done with a PreparedStatement and I > use only > setLong(), setString(), setTimestamp() and setInt(). > =20 > =20 > I don't understand it very well. It is obviously an encoding > exception > but I don't know why it happens and what I could do avoid it. > =20 > Any idea? > =20 > _________________________________________________________________ > Opret en personlig blog og del dine billeder p=C3=A5 MSN Spaces:=20 > http://spaces.msn.com/ > =20 > =20 > ---------------------------(end of > broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an > appropriate > subscribe-nomail command to majordomo@postgresql.org so that > your > message can get through to the mailing list cleanly >=20 >=20 > ______________________________________________________________________ > Don't get soaked. Take aquick peak at the forecast=20 > with theYahoo! Search weather shortcut.