RE: JDBC and Unicode problem

From: Zeljko Trogrlic <zeljko(at)technologist(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Cc: "Peter Mount (Home)" <peter(at)retep(dot)org(dot)uk>
Subject: RE: JDBC and Unicode problem
Date: 2000-09-06 12:44:29
Message-ID: 4.1.20000906143455.01910170@pop.tel.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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]);
with
return 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.

Browse pgsql-interfaces by date

  From Date Subject
Next Message Bob Kline 2000-09-06 12:56:53 Re: JDBC Driver Help...
Previous Message Bob Kline 2000-09-06 12:28:38 Re: Pasing Cursors