From: | Joseph Shraibman <jks(at)selectacast(dot)net> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: ArrayIndexOutOfBoundsException in Encoding.decodeUTF8() |
Date: | 2003-01-07 23:32:14 |
Message-ID: | 3E1B637E.1080209@selectacast.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-jdbc |
BTW the string that caused this is 'Oné'
Joseph Shraibman wrote:
> java.lang.ArrayIndexOutOfBoundsException: 3
> at org.postgresql.core.Encoding.decodeUTF8(Encoding.java:253)
> at org.postgresql.core.Encoding.decode(Encoding.java:165)
> at org.postgresql.core.Encoding.decode(Encoding.java:181)
> at
> org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(AbstractJdbc1ResultSet.java:97)
>
>
> The relavent code is:
>
> while (i < k) {
> z = data[i] & 0xFF;
> if (z < 0x80) {
> l_cdata[j++] = (char)data[i];
> i++;
> } else if (z >= 0xE0) { // length == 3
> y = data[i+1] & 0xFF; //<<== THIS IS LINE 253
> x = data[i+2] & 0xFF;
> val = (z-0xE0)*pow2_12 + (y-0x80)*pow2_6 + (x-0x80);
> l_cdata[j++] = (char) val;
> i+= 3;
> } else { // length == 2 (maybe add checking for
> length > 3, throw exception if it is
>
>
> And in the method that calls that:
>
> if (encoding.equals("UTF-8")) {
> return decodeUTF8(encodedString, offset, length);
> }
>
> The thing is my database encoding is SQL_ASCII
>
> => SELECT version(), getdatabaseencoding() ;
> version
> | getdatabaseencoding
> ---------------------------------------------------------------------------------------------------------+---------------------
>
> PostgreSQL 7.3.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2
> 20020903 (Red Hat Linux 8.0 3.2-7) | SQL_ASCII
> (1 row)
>
> ... so why is it trying to decode the string as UTF-8? I just upgraded
> this database from 7.2.3 yesterday.
>
--
Joseph Shraibman
joseph(at)xtenit(dot)com
Increase signal to noise ratio. http://xis.xtenit.com
From | Date | Subject | |
---|---|---|---|
Next Message | johnnnnnn | 2003-01-07 23:33:25 | Re: [GENERAL] I feel the need for speed. What am I doing wrong? |
Previous Message | Joseph Shraibman | 2003-01-07 23:20:25 | ArrayIndexOutOfBoundsException in Encoding.decodeUTF8() |
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2003-01-08 01:34:48 | Re: ArrayIndexOutOfBoundsException in Encoding.decodeUTF8() |
Previous Message | Joseph Shraibman | 2003-01-07 23:20:25 | ArrayIndexOutOfBoundsException in Encoding.decodeUTF8() |