Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 04D41634E93 for ; Mon, 27 Jul 2009 05:24:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 38640-01-4 for ; Mon, 27 Jul 2009 08:24:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mailbackup.inode.at (mailbackup.inode.at [213.229.60.24]) by mail.postgresql.org (Postfix) with ESMTP id BE34E634B68 for ; Mon, 27 Jul 2009 05:24:00 -0300 (ADT) Received: from [62.99.145.5] (port=65154 helo=mx.inode.at) by mailbackup.inode.at with esmtp (Exim 4.67) (envelope-from ) id 1MVLV1-0002jo-FL for pgsql-jdbc@postgresql.org; Mon, 27 Jul 2009 10:23:59 +0200 Received: from [83.64.182.18] (port=7947 helo=donald.apus.co.at) by smartmx-05.inode.at with esmtp (Exim 4.69) (envelope-from ) id 1MVLUs-00089I-Hv; Mon, 27 Jul 2009 10:23:50 +0200 Received: from localhost (localhost [127.0.0.1]) by donald.apus.co.at (Postfix) with ESMTP id 12A973EA014; Mon, 27 Jul 2009 10:23:48 +0200 (CEST) X-Virus-Scanned: amavisd-new at donald.apus.co.at Received: from donald.apus.co.at ([127.0.0.1]) by localhost (donald.apus.co.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J4Im-WufNv3r; Mon, 27 Jul 2009 10:23:47 +0200 (CEST) Received: from donald.apus.co.at (localhost [127.0.0.1]) by donald.apus.co.at (Postfix) with ESMTP id 647A73EA00E; Mon, 27 Jul 2009 10:23:47 +0200 (CEST) Date: Mon, 27 Jul 2009 09:23:47 +0100 (GMT+01:00) From: Markus Kickmaier To: Daniel Migowski Cc: pgsql-jdbc@postgresql.org Message-ID: <5637857.99741248683027131.JavaMail.root@donald.apus.co.at> In-Reply-To: <19350541.99721248682978507.JavaMail.root@donald.apus.co.at> Subject: Re: Encoding from CopyManager.copyIn() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [193.1.1.213] X-Mailer: Zimbra 5.0.16_GA_2921.UBUNTU8 (ZimbraWebClient - FF3.0 (Win)/5.0.16_GA_2921.UBUNTU8) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=-10 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/76 X-Sequence-Number: 19844 Thanks for the Responses Daniel and Kris, but i just don't get it work. I know now what exactly my problem is. I have a SQL_ASCCI encoded database. The JDBC driver uses UNICODE as client= _encoding. So if i want to copy an 'umlaut' like =C3=BC into a table i get = the error: invalid byte sequence for UTF8... If i test this in pgAdmin it is the same. But if i set client_encoding to '= SQL_ASCII' in pgAdmin it works fine. Trying this for my JDBC connection i get a PSQL Exception saying that the c= lient_encoding parameter was changed to SQL_ASCII and the JDBC driver just = works correctly with UNICODE. Any ideas? I'm rather sure it would work if JDBC would let me use SQL_ASCII= . BR, Markus ----- "Daniel Migowski" schrieb: > Or, in your case you have to wrap the OutputStream in an=20 > OutputStreamWriter (which has the encoding parameter in the > constructor). >=20 > best > Daniel >=20 > Markus Kickmaier schrieb: > > Hello, > > > > I'm using the copyIn() function of the CopyManager. It works fine > until I don't use an "umlaut" like =C3=BC. Then i get an PSQLException: > > > > org.postgresql.util.PSQLException: ERROR: invalid byte sequence for > encoding "UTF8": 0xfc > > > > My code looks like follows: > > > > ByteArrayOutputStream output =3D new ByteArrayOutputStream(); > > PrintWriter writer =3D new PrintWriter(output); > > writer.println("abc=C3=BC=C3=A4=C3=B6"); > > writer.flush(); > > ByteArrayInputStream input =3D new > ByteArrayInputStream(output.toByteArray()); > > long result =3D ((PGConnection) con_).getCopyAPI().copyIn(statement, > input); > > > > After searching at google i found out that this is an encoding > problem. The database doesn't know what charset I'm using. > > > > Any suggestion how i can specify the encoding i want to use? > > > > BR, Markus > > > >