X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D45C13A40C7; Mon, 8 Nov 2004 21:53:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47310-01; Mon, 8 Nov 2004 21:53:38 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 3894C3A409A; Mon, 8 Nov 2004 21:53:36 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CRHS4-0007Tp-00; Tue, 09 Nov 2004 10:53:28 +1300 Message-ID: <418FEB6B.3000700@opencloud.com> Date: Tue, 09 Nov 2004 10:55:55 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.8 (X11/20041021) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "J. Michael Crawford" Cc: Kris Jurka , pgsql-general@postgresql.org, pgsql-jdbc@postgresql.org Subject: Re: [JDBC] Using Postgres with Latin1 (ISO8859-1) References: <418F8A30.8010305@deg.cc> <6.1.2.0.2.20041108105839.02fdcfe0@pop.suscom-maine.net> <6.1.2.0.2.20041108160948.02fd4638@pop.suscom-maine.net> In-Reply-To: <6.1.2.0.2.20041108160948.02fd4638@pop.suscom-maine.net> X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/343 X-Sequence-Number: 68423 J. Michael Crawford wrote: > Encoding translations that didn't work: > > a) Getting encoded bytes from the result set. We tried the following > block five times, once for each different encoding we were trying to > test with the database: > b) Getting a string, turning it bytes, and then translating. Same > process as above, but we use result.getString... > No matter what, strings showed up as gibberish in one JVM or another, > depending upon the native encoding of the database. A Latin1 database > worked in the windows JVM, a Unicode in the Linux JVM, but not the other > way around. The "right way" is to just use getString() and not do any translation yourself. The driver has already done the transcoding from whatever the DB encoding is, to the internal UTF-16 string representation. You don't need to mess with byte-based representations. When you then display that string, you will need to use an appropriate encoding, obviously.. Can you provide a self-contained testcase that demonstrates getString() doing the wrong thing? -O