X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7D533D1B80B for ; Thu, 5 Feb 2004 23:05:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 32796-08 for ; Thu, 5 Feb 2004 19:05:49 -0400 (AST) Received: from boggle.pobox.com (boggle.pobox.com [208.58.1.193]) by svr1.postgresql.org (Postfix) with ESMTP id 90E34D1B4DA for ; Thu, 5 Feb 2004 19:05:46 -0400 (AST) Received: from colander (localhost [127.0.0.1]) by boggle.pobox.com (Postfix) with ESMTP id 5150635FD4 for ; Thu, 5 Feb 2004 18:05:39 -0500 (EST) Received: from jester.pobox.com (jester.pobox.com [64.71.166.114]) by boggle.pobox.com (Postfix) with ESMTP for ; Thu, 5 Feb 2004 18:04:48 -0500 (EST) Received: from [192.168.1.115] (unknown [67.64.77.89]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by jester.pobox.com (Postfix) with ESMTP id 5959C1AB for ; Thu, 5 Feb 2004 18:04:30 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v612) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; format=flowed To: pgsql-sql From: Chris Anderson Subject: Could not convert UTF-8 to ISO8859-1 Date: Thu, 5 Feb 2004 17:04:28 -0600 X-Mailer: Apple Mail (2.612) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/57 X-Sequence-Number: 16748 I've noticed a difference in behavior between 7.2 and 7.3 with regards to character recoding and I'm a little perplexed about how to work around. I have a database in LATIN-1 that is accessed read-write by a Java app. Naturally, the Java code keeps all of its strings in UTF8 so when I prepare a sql statement, someone is recoding these characters to LATIN-1 for me. In 7.2, if the Unicode string contained a character that wasn't valid in the database encoding (LATIN-1) either pgsql or the jdbc driver (I'm not really sure which) would silently convert these characters to question marks. In 7.3, the same string will throw a "Could not convert UTF-8 to ISO8859-1" error. I can work around this by doing the following hack in Java: String s = "some unicode string"; byte[] tmp = s.getBytes("latin1"); s = new String(tmp, 0, tmp.length, "latin1"); But I'm sure there is a better way to do this. Any suggestions? cva