Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id BECB7632281 for ; Tue, 28 Jul 2009 09:52:40 -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 54729-05 for ; Tue, 28 Jul 2009 12:52:22 +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 B545E632888 for ; Tue, 28 Jul 2009 09:52:28 -0300 (ADT) Received: from [62.99.145.9] (port=65240 helo=mx.inode.at) by mailbackup.inode.at with esmtp (Exim 4.67) (envelope-from ) id 1MVmAM-00035l-Sv for pgsql-jdbc@postgresql.org; Tue, 28 Jul 2009 14:52:26 +0200 Received: from [83.64.182.18] (port=9146 helo=donald.apus.co.at) by smartmx-09.inode.at with esmtp (Exim 4.69) (envelope-from ) id 1MVm9z-0002dm-Bm; Tue, 28 Jul 2009 14:52:03 +0200 Received: from localhost (localhost [127.0.0.1]) by donald.apus.co.at (Postfix) with ESMTP id 2575D3EA014; Tue, 28 Jul 2009 14:52:00 +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 tK256cjmd7MR; Tue, 28 Jul 2009 14:51:58 +0200 (CEST) Received: from donald.apus.co.at (localhost [127.0.0.1]) by donald.apus.co.at (Postfix) with ESMTP id 905EC3EA006; Tue, 28 Jul 2009 14:51:58 +0200 (CEST) Date: Tue, 28 Jul 2009 13:51:58 +0100 (GMT+01:00) From: Markus Kickmaier To: Oliver Jowett Cc: Daniel Migowski , pgsql-jdbc@postgresql.org Message-ID: <4582381.102821248785518175.JavaMail.root@donald.apus.co.at> In-Reply-To: <4A6E8F59.7080004@opencloud.com> 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: [195.34.153.81] 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/78 X-Sequence-Number: 19846 Hi, what I've done now is following: - I converted my database to UTF8. - I use a OutputStreamWriter with UTF8 as encoding to fill my stream for th= e copy statement. Now it works. Thanks for your help. BR, Markus ----- "Oliver Jowett" schrieb: > Markus Kickmaier wrote: > > Thanks for the Responses Daniel and Kris, > >=20 > > 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 tabl= e > i get the error: invalid byte sequence for UTF8... > >=20 > > 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 client_encoding parameter was changed to SQL_ASCII and the > JDBC driver just works correctly with UNICODE. > >=20 > > Any ideas? I'm rather sure it would work if JDBC would let me use > SQL_ASCII. >=20 > You should convert your database to an appropriate encoding for the > data=20 > it contains (perhaps LATIN1?). If the database encoding is SQL_ASCII, >=20 > the JDBC driver has no way of knowing how to convert bytes >127 to=20 > Java's UTF-16 String representation. >=20 > Basically, SQL_ASCII is only going to work with the JDBC driver if you >=20 > only store 7-bit ASCII, or if you happen to be very lucky and have all >=20 > clients everywhere use a client_encoding of UNICODE. >=20 > -O