Re: 7.3.1 UTF-8 bug(?) and 7.2.x Charset compatibility

From: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: 7.3.1 UTF-8 bug(?) and 7.2.x Charset compatibility
Date: 2003-01-28 15:37:40
Message-ID: Pine.LNX.4.44.0301281334100.14676-100000@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, 28 Jan 2003, Achilleus Mantzios wrote:

I found another guy having the same problem (as problem #2)
using postgresql 7.3.1 with resin.
http://www.caucho.com/support/ejb-interest/0212/0049.html

He suggested that the garbled input was do to the "smart quotes"
some MS products are inserting.

>
> Hi i encountered 2 problems regarding the 7.3.1 jdbc driver.
>
> 1) The new 7.3.1 assumes data is stored in UNICODE in the database
> (which is most likely reloaded from a 7.2.x dump)
> For instance, in my case all text data in my 7.2.3 were
> ISO-8859-7 (Greek) (8bit ASCII compatible).
> I was not able to read these data correctly since the driver
> assumed i stored them in utf-8.
>
> 2) When the contents of a varchar or text field are the
> ASCII 0xA0 0x0A (which for some reason IE strangely produces)
> the driver throws an java.lang.ArrayIndexOutOfBoundsException :
>
> 2003-01-27 11:50:55,665 ERROR [STDERR]
> java.lang.ArrayIndexOutOfBoundsException
> 2003-01-27 11:50:55,666 ERROR [STDERR] at
> org.postgresql.core.Encoding.decodeUTF8(Encoding.java:259)
> 2003-01-27 11:50:55,667 ERROR [STDERR] at
> org.postgresql.core.Encoding.decode(Encoding.java:165)
> 2003-01-27 11:50:55,667 ERROR [STDERR] at
> org.postgresql.core.Encoding.decode(Encoding.java:181)
> 2003-01-27 11:50:55,668 ERROR [STDERR] at
> org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(AbstractJdbc1ResultSet.java:97)
>
> In order to solve these 2 problems for my case , i.e. with no need
> for unicode support i wrote this simple patch.
> (Note this patch is usefull only for people who DONT NEED
> multibyte support)
> --------------------------cut here------------------------------
> *** AbstractJdbc1Connection.java.orig Tue Jan 28 09:42:54 2003
> --- AbstractJdbc1Connection.java Tue Jan 28 09:50:09 2003
> ***************
> *** 372,382 ****
> //support is now always included
> if (haveMinimumServerVersion("7.3"))
> {
> java.sql.ResultSet acRset =
> ! ExecSQL("set client_encoding = 'UNICODE'; show autocommit");
>
> //set encoding to be unicode
> ! encoding = Encoding.getEncoding("UNICODE", null);
>
> if (!acRset.next())
> {
> --- 372,384 ----
> //support is now always included
> if (haveMinimumServerVersion("7.3"))
> {
> + // java.sql.ResultSet acRset =
> + // ExecSQL("set client_encoding = 'UNICODE'; show autocommit");
> java.sql.ResultSet acRset =
> ! ExecSQL("show autocommit");
>
> //set encoding to be unicode
> ! // encoding = Encoding.getEncoding("UNICODE", null);
>
> if (!acRset.next())
> {
> -------------------cut here-------------------------------------------
> ==================================================================
> Achilleus Mantzios
> S/W Engineer
> IT dept
> Dynacom Tankers Mngmt
> Nikis 4, Glyfada
> Athens 16610
> Greece
> tel: +30-10-8981112
> fax: +30-10-8981877
> email: achill(at)matrix(dot)gatewaynet(dot)com
> mantzios(at)softlab(dot)ece(dot)ntua(dot)gr
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-10-8981112
fax: +30-10-8981877
email: achill(at)matrix(dot)gatewaynet(dot)com
mantzios(at)softlab(dot)ece(dot)ntua(dot)gr

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jeremy Buchmann 2003-01-28 16:13:30 Re: where to put postgresql.jar in Mac OS X
Previous Message Achilleus Mantzios 2003-01-28 12:58:24 7.3.1 UTF-8 bug(?) and 7.2.x Charset compatibility