RE: JDBC and Unicode problem - Mailing list pgsql-interfaces

From Zeljko Trogrlic
Subject RE: JDBC and Unicode problem
Date
Msg-id 4.1.20000906143455.01910170@pop.tel.hr
Whole thread Raw
In response to JDBC and Unicode problem  (Zeljko Trogrlic <zeljko@technologist.com>)
List pgsql-interfaces
Solution for automatic encoding detection:
* Make a Hashmap that maps PostgreSQL encoding names to Java encoding names
(UNICODE = UTF-8)
* When getConnection is called, execute select getdatabaseencoding(). This
will return encoding name.
* Get Java encoding name and store it into connection specific variable.
* When executing SQL-s or reading data, use that encoding as parameter.

In getString, replace:return new String(this_row[columnIndex - 1]);
withreturn new String(this_row[columnIndex - 1], encoding);

And JDBC will work for all encodings entered into mapping Hashmap. If I
only had write CVS access... ;)

At 10:01 6.9.2000 , Peter Mount wrote:
>It isn't a bug as such as I've never implemented unicode.
>
>However, your solution looks like a good one, but I'm not sure how you would
>pass that parameter to either an applet or a servlet.



pgsql-interfaces by date:

Previous
From: Ken Kachnowich
Date:
Subject: Performance issue with JDBC
Next
From: Zeljko Trogrlic
Date:
Subject: Re: JDBC and Unicode problem