Received: from as104.tel.hr (as104.tel.hr [205.219.255.36]) by hub.org (8.10.1/8.10.1) with ESMTP id e86ChcB47334 for ; Wed, 6 Sep 2000 08:43:38 -0400 (EDT) Received: from adder (ao1-m204.tel.hr [195.29.32.204]) by as104.tel.hr (0.0.0/0.0.0) with SMTP id OAA224576; Wed, 6 Sep 2000 14:43:36 +0200 (MEST) Message-Id: <4.1.20000906143455.01910170@pop.tel.hr> X-Sender: X-Mailer: QUALCOMM Windows Eudora Pro Version 4.1 Date: Wed, 06 Sep 2000 14:44:29 +0200 To: pgsql-interfaces@postgresql.org From: Zeljko Trogrlic Subject: RE: JDBC and Unicode problem Cc: "Peter Mount (Home)" In-Reply-To: <1B3D5E532D18D311861A00600865478CF1B350@exchange1.nt.maidst one.gov.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Archive-Number: 200009/28 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.