X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DFDF9D1B1CD for ; Wed, 4 Aug 2004 15:38:19 -0300 (ADT) 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 31001-03 for ; Wed, 4 Aug 2004 18:38:10 +0000 (GMT) Received: from pan.gwi.net (pan.gwi.net [207.5.128.165]) by svr1.postgresql.org (Postfix) with ESMTP id 6C687D1B17B for ; Wed, 4 Aug 2004 15:38:06 -0300 (ADT) Received: from manifest.gwi.net (228-44.suscom-maine.net [207.5.228.44]) by pan.gwi.net (8.12.9p2/8.12.9) with ESMTP id i74Ic67D067146 for ; Wed, 4 Aug 2004 14:38:06 -0400 (EDT) (envelope-from jmichael@gwi.net) Message-Id: <6.1.1.1.2.20040804140140.0337bf10@mail.nuomo.com> X-Sender: jmichael@pop.suscom-maine.net X-Mailer: QUALCOMM Windows Eudora Version 6.1.1.1 Date: Wed, 04 Aug 2004 14:34:39 -0400 To: pgsql-jdbc@postgresql.org From: "J. Michael Crawford" Subject: JDBC Latin1 problem Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable 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: 200408/24 X-Sequence-Number: 10746 We have a PostgreSQL 7.3.4 database running in redhat, defined as Latin1= =20 when created, with the client connection sent to Latin1. The data looks=20 fine when queried. When using our server application running in windows=20 (jvm build 1.4.2_04-b05), with the pg73jdbc3.jar jdbc driver, we get the=20 right information from the rs.getString() method, and it looks fine in web= =20 pages encoded with Latin1. However, when using the exact same classes and driver on the redhat=20 Linux box (jvm build 1.4.2_01-b06), we get garbage wherever there's a latin= =20 character. Same database, same classes, same driver. The Linux jvm has a default character encoding of UTF8, while the=20 windows jvm has a default character encoding of Cp1252. Here's what we've tried: ?charSet=3D We've tried every combination of adding ?charSet=3D to the url, such as= =20 ?charSet=3DLATIN1, ?charSet=3DISO_8859_1, ?charSet=3DUTF_8, ?charSet=3DUNIC= ODE, and=20 even appending the following to the url: "?charset=3D" +=20 sun.io.ByteToCharConverter.getDefault().getCharacterEncoding(); We've=20 tried both dashes and underscores. We've also tried ?encoding=3D as well. data =3D resultSet.getString("page_title_es"); byte[] text=3Ddata.getBytes("utf-8"); String data1=3Dnew String(text,"LATIN1"); We've tried the above going from utf-8 to Latin1, utf-8 to utf-8, utf-8= =20 to iso-8859-1, iso-8859-1 to utf-8, iso-8859-1 to Latin1, iso-8859-1 to=20 iso-8859-1, Latin1 to Latin1, Latin1 to utf-8, Latin1 to iso-8859-1. We=20 may have tried others. Nothing has helped. We'll try nine at a time and= =20 all will come up with some variation of "Introducci=C3=B3n" instead of=20 "Introducci=F3n" (hopefully this message shows the second introduccion with= =20 an accent over the o, and not gibberish). Any ideas? There's probably something very simple that will look=20 obvious in hindsight -- I'm sure that others have retrieved Latin1=20 characters from a Latin1 database via jdbc on a Linux jvm with a default=20 character set of utf-8. I'm just not sure we'll be able to figure this one= =20 out on our own. - Mike