pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Zeljko Trogrlic <zeljko@technologist.com>
To: pgsql-interfaces@postgresql.org
Cc: Peter Mount (Home) <peter@retep.org.uk>
Subject: RE: JDBC and Unicode problem
Date: Wed, 06 Sep 2000 14:44:29 +0200
Message-ID: <4.1.20000906143455.01910170@pop.tel.hr> (raw)
In-Reply-To: <1B3D5E532D18D311861A00600865478CF1B350@exchange1.nt.maidst one.gov.uk>

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.




view thread (13+ messages)  latest in thread

Message-ID: <4.1.20000906143455.01910170@pop.tel.hr>
Permalink:  ../4.1.20000906143455.01910170@pop.tel.hr/
Also on:    postgresql.org/message-id/4.1.20000906143455.01910170@pop.tel.hr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: zeljko@technologist.com, peter@retep.org.uk
  Subject: RE: JDBC and Unicode problem
  In-Reply-To: <4.1.20000906143455.01910170@pop.tel.hr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox