From owner-freebsd-ports Sat Jun 2 19:50:11 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D4FAE37B43E for ; Sat, 2 Jun 2001 19:50:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f532o0V91864; Sat, 2 Jun 2001 19:50:00 -0700 (PDT) (envelope-from gnats) Received: from palle.girgensohn.se (c213.89.165.253.cm-upc.chello.se [213.89.165.253]) by hub.freebsd.org (Postfix) with ESMTP id 9AB3D37B42C for ; Sat, 2 Jun 2001 19:44:24 -0700 (PDT) (envelope-from girgen@palle.girgensohn.se) Received: (from girgen@localhost) by palle.girgensohn.se (8.11.3/8.11.3) id f532iMa32271; Sun, 3 Jun 2001 04:44:22 +0200 (CEST) (envelope-from girgen) Message-Id: <200106030244.f532iMa32271@palle.girgensohn.se> Date: Sun, 3 Jun 2001 04:44:22 +0200 (CEST) From: girgen@partitur.se Reply-To: girgen@partitur.se To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/27846: databases/postgresql7 update for Java character encoding Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 27846 >Category: ports >Synopsis: databases/postgresql7 update for Java character encoding >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Sat Jun 02 19:50:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Palle Girgensohn >Release: FreeBSD 4.3-STABLE i386 >Organization: Partitur >Environment: System: FreeBSD palle.girgensohn.se 4.3-STABLE FreeBSD 4.3-STABLE #0: Sat May 19 03:59:57 CEST 2001 girgen@palle.girgensohn.se:/usr/obj/usr/src/sys/STORDATAN i386 >Description: With version 7.1, the JDBC implementation started checking the postgres server for character encoding, but this only worked well when multibyte encoding was activated when postgres was built. Without multibyte, the server will always anser SQL_ASCII, and this would set the JVM to use seven-bit ascii, and put '?' for all eight-bit (e.g. latin1) characters. >How-To-Repeat: >Fix: This is a patch from the postgres' CVS repository. bump revision and cvs add the patch file. As a bonus, add support for Korean, KOI8_R, encoding. Index: Makefile =================================================================== RCS file: /home/ncvs/ports/databases/postgresql7/Makefile,v retrieving revision 1.84 diff -u -u -r1.84 Makefile --- Makefile 2001/06/01 06:04:48 1.84 +++ Makefile 2001/06/03 02:08:03 @@ -7,6 +7,7 @@ PORTNAME= postgresql PORTVERSION= 7.1.2 +PORTREVISION= 2 CATEGORIES= databases MASTER_SITES= ftp://ftp.iodynamics.com/pub/mirror/postgresql/%SUBDIR%/ \ ftp://ftp.postgresql.org/pub/%SUBDIR%/ \ --- /dev/null Sun Jun 3 04:26:51 2001 +++ files/patch-jdbc-Connection Sun Jun 3 03:56:23 2001 @@ -0,0 +1,51 @@ +=================================================================== +RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Connection.java,v +retrieving revision 1.14 +retrieving revision 1.16 +diff -u -r1.14 -r1.16 +--- src/interfaces/jdbc/org/postgresql/Connection.java 2001/01/31 08:26:01 1.14 ++++ src/interfaces/jdbc/org/postgresql/Connection.java 2001/06/01 20:57:58 1.16 +@@ -10,7 +10,7 @@ + import org.postgresql.util.*; + + /** +- * $Id: Connection.java,v 1.14 2001/01/31 08:26:01 peter Exp $ ++ * $Id: Connection.java,v 1.16 2001/06/01 20:57:58 momjian Exp $ + * + * This abstract class is used by org.postgresql.Driver to open either the JDBC1 or + * JDBC2 versions of the Connection class. +@@ -267,7 +267,8 @@ + // + firstWarning = null; + +- java.sql.ResultSet initrset = ExecSQL("set datestyle to 'ISO'; select getdatabaseencoding()"); ++ java.sql.ResultSet initrset = ExecSQL("set datestyle to 'ISO'; " + ++ "select case when pg_encoding_to_char(1) = 'SQL_ASCII' then 'UNKNOWN' else getdatabaseencoding() end"); + + String dbEncoding = null; + //retrieve DB properties +@@ -307,9 +308,23 @@ + } else if (dbEncoding.equals("EUC_TW")) { + dbEncoding = "EUC_TW"; + } else if (dbEncoding.equals("KOI8")) { +- dbEncoding = "KOI8_R"; ++ // try first if KOI8_U is present, it's a superset of KOI8_R ++ try { ++ dbEncoding = "KOI8_U"; ++ "test".getBytes(dbEncoding); ++ } ++ catch(UnsupportedEncodingException uee) { ++ // well, KOI8_U is still not in standard JDK, falling back to KOI8_R :( ++ dbEncoding = "KOI8_R"; ++ } ++ + } else if (dbEncoding.equals("WIN")) { + dbEncoding = "Cp1252"; ++ } else if (dbEncoding.equals("UNKNOWN")) { ++ //This isn't a multibyte database so we don't have an encoding to use ++ //We leave dbEncoding null which will cause the default encoding for the ++ //JVM to be used ++ dbEncoding = null; + } else { + dbEncoding = null; + } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message