Received: from ns.gcom.ru (Garant-Siberia-PostOffice.gcom.ru [194.84.180.33]) by hub.org (8.8.8/8.8.8) with ESMTP id GAA22361 for ; Fri, 9 Oct 1998 06:58:14 -0400 (EDT) (envelope-from avd@avd.garsib.ru) Received: (from uucp@localhost) by ns.gcom.ru (8.6.10/8.6.10) id QAA18557 for ; Fri, 9 Oct 1998 16:57:59 +0600 Received: from avd.garsib.ru(194.135.7.80) via SMTP by Garant-Siberia-PostOffice.gcom.ru, id smtpd018555; Fri Oct 9 17:57:49 1998 Received: (from avd@localhost) by avd.garsib.ru (8.8.8/8.8.8) id SAA01827; Fri, 9 Oct 1998 18:08:35 +0700 (NSS) (envelope-from avd) To: pgsql-interfaces@postgresql.org Subject: JDBC and character encoding From: Aleksey Demakov Date: 09 Oct 1998 18:08:32 +0700 Message-ID: <87ww6aouvi.fsf@avd.garsib.ru> Lines: 26 X-Mailer: Gnus v5.5/Emacs 20.2 There is a problem using JDBC on machine with a character encoding different from one used by backend. For instance, Russian version of MS Windows uses codepage 1251, while in Russian Unix world most widely used encoding is koi8-r. I don't know whether there's standard way of dealing with this. Maybe because I'm novice with Java & JDBC. But having Java i18n facilities this problem could be easely solved. There should be a per-connection property which will contain beckend's encoding. So connecting with, say, such url "jdbc:postgresql://host/database?encoding=KOI8-R" will set this property to "KOI8-R". Functions to convert bytes to characters and vice versa all have versions that accept encoding argument. They should be used to perform such conversion. I currently only have the driver from 6.3.2 distribution. I could make a patch for it if JDBC maintainers agree with this proposal. Regards, Aleksey -- Aleksey Demakov avd@gcom.ru