X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4CCDBD1B489 for ; Fri, 4 Jun 2004 08:34:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32824-08 for ; Fri, 4 Jun 2004 11:34:47 +0000 (GMT) Received: from mx1.rnbq.biz (mail.rnbq.biz [81.1.233.3]) by svr1.postgresql.org (Postfix) with ESMTP id 8F00FD1B459 for ; Fri, 4 Jun 2004 08:34:42 -0300 (ADT) Received: from 192.168.0.1 (helo=ws35) by mx1.rnbq.biz with asmtp id 1BWCyA-000Pz7-RR for pgsql-jdbc@postgresql.org; Fri, 04 Jun 2004 11:34:42 +0000 Date: Fri, 4 Jun 2004 18:33:11 +0700 From: Vasiliev Ivan X-Mailer: The Bat! (v1.60q) Personal Reply-To: Vasiliev Ivan X-Priority: 3 (Normal) Message-ID: <1701580283984.20040604183311@folksnet.com> To: pgsql-jdbc@postgresql.org Subject: bug report MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200406/16 X-Sequence-Number: 10218 Hello All! I use a database with type UNICODE, execute query "select * from some_table". One field has type text. There are some Europe symbols, which code more than 128. In method private synchronized String Enconding#decodeUTF8(byte data[], int offset, int length) throws SQLException exeption ArrayIndexOutOfBoundsException occures in last else block: } else { // length == 2 (maybe add checking for length > 3, throw exception if it is y = data[i+1] & 0xFF; val = (z - 0xC0)* (pow2_6)+(y-0x80); l_cdata[j++] = (char) val; i+=2; } Then your PSQLException is created. But I have made a trick : } catch (Exception l_e) { try { return new String(data, offset, length, "UTF-8"); } catch(Exception e) { throw new PSQLException("postgresql.con.invalidchar", l_e); } } And, as no exception occures during string creation, your "fast code" decodeUTF8() has an error, I suppose.... Database server version: PostgreSQL 7.4.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 20030222 (ASPLinux 3.2.2-5asp) JDBC driver: pg74.213.jdbc3.jar (this method doesn't differ from driver devpgjdbc3.jar) Let me know, if I wrong, or may be you want some additional information. -- Best regards, Vasiliev mailto:biggod@folksnet.com