Skip site navigation (1) Skip section navigation (2)

getTables() doesn't handle umlauts correctly

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: getTables() doesn't handle umlauts correctly
Date: 2010-11-21 22:44:56
Message-ID: icc7cc$19a$1@dough.gmane.org (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hi,

I noticed that the driver will return incorrect values for table names that contain umlauts. Consider the following code:

Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://localhost/postgres", "postgres", "password");
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

Regards
Thomas


Responses

pgsql-jdbc by date

Next:From: Itagaki TakahiroDate: 2010-11-22 06:37:31
Subject: Re: [JDBC] Support for JDBC setQueryTimeout, et al.
Previous:From: Radosław SmoguraDate: 2010-11-21 18:49:28
Subject: Experimental JDBC driver

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group