Re: getTables() doesn't handle umlauts correctly

Поиск
Список
Период
Сортировка
От Lew
Тема Re: getTables() doesn't handle umlauts correctly
Дата
Msg-id icdqc3$v7n$1@news.albasani.net
обсуждение исходный текст
Ответ на getTables() doesn't handle umlauts correctly  (Thomas Kellerer <spam_eater@gmx.net>)
Ответы Re: getTables() doesn't handle umlauts correctly  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-jdbc
Thomas Kellerer wrote:
> I noticed that the driver will return incorrect values for table names
> that contain umlauts. Consider the following code:
>
> Class.forName("org.postgresql.Driver");

You only need to load the class once.

> 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

Sounds like your database character encoding doesn't match up.

--
Lew

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Radosław Smogura
Дата:
Сообщение: TypeInfoCache.getPGArrayElement - determine if array
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: getTables() doesn't handle umlauts correctly