Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id B9E9A1337B34 for ; Mon, 22 Nov 2010 09:50:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 01834-03 for ; Mon, 22 Nov 2010 13:50:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 4D68C1335B36 for ; Mon, 22 Nov 2010 09:50:49 -0400 (AST) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PKWnA-0005wV-Mo for pgsql-jdbc@postgresql.org; Mon, 22 Nov 2010 14:50:48 +0100 Received: from h-213.61.77.202.host.de.colt.net ([213.61.77.202]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 22 Nov 2010 14:50:48 +0100 Received: from spam_eater by h-213.61.77.202.host.de.colt.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 22 Nov 2010 14:50:48 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: getTables() doesn't handle umlauts correctly Date: Mon, 22 Nov 2010 14:50:38 +0100 Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: h-213.61.77.202.host.de.colt.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/55 X-Sequence-Number: 21176 Lew, 22.11.2010 14:14: >> stmt = con.createStatement(); >> stmt.executeUpdate("create table public.umlaut_test_รถ (id integer)"); >> rs = con.getMetaData().getTables(null, "public", "umlaut_test%", null); >> while (rs.next()) >> { >> System.out.println(rs.getString("TABLE_NAME")); >> } >> >> It will not display the table name correctly. >> >> Now on the console this might be an encoding problem of the client, but >> the name is also not displayed correctly, when e.g. using a Swing JLabel >> component which is fully UTF-8 compatible. >> >> Is there a connection parameter for the driver to return that correctly >> or is this a driver bug? >> >> I'm using the 9.0-801 driver with a 9.0.1 database running on Windows XP > > Sounds like your database character encoding doesn't match up. select pg_encoding_to_char(encoding) from pg_database returns UTF8 (for all databases) I verified that my Java code was compiled using UTF-8 as well, to be sure nothing was lost there. The problem also shows up when using a JDBC based query tool. Btw: the same happens with pgAdmin as well. The above created table will be displayed with an "empty" Name in the pgAdmin tree Regards Thomas