Re: [JDBC] ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: Barry Lind <blind(at)xythos(dot)com>, pgsql-general(at)postgresql(dot)org
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()
Date: 2003-01-08 21:35:15
Message-ID: 3E1C9993.5000807@selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

Barry Lind wrote:
> Joseph,
>
> In postgres UNICODE means utf8.

Which differs from java unicode?

I notice there is no way to change a database's encoding. If I just change the encoding
type in the pg_database to latin1 will there be data loss?

>
> --Barry
>
> Joseph Shraibman wrote:
>
>> Barry Lind wrote:
>>
>>> Joseph,
>>>
>>> The problem is that your database claims to be ASCII, but you are
>>> storing non-ascii data in it.
>>>
>>> As of 7.3 the jdbc driver has the server convert from the database
>>> character set to UTF8. Then send the data to the driver in UTF8 and
>>> the driver then decodes the UTF8 to java unicode.
>>
>>
>>
>> I see this in my postgres log when I connect via jdbc:
>>
>> LOG: query: set datestyle to 'ISO'; select version(), case when
>> pg_encoding_to_char(1) = 'SQL_ASCII' then 'UNKNOWN' else
>> getdatabaseencoding() end;
>> LOG: query: set client_encoding = 'UNICODE'; show autocommit
>>
>> So if client_encoding is unicode why is the driver trying to convert
>> from UTF8?
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 5: Have you checked our extensive FAQ?
>>
>> http://www.postgresql.org/users-lounge/docs/faq.html
>>
>

--
Joseph Shraibman
joseph(at)xtenit(dot)com
Increase signal to noise ratio. http://xis.xtenit.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Barry Lind 2003-01-08 21:47:00 Re: [JDBC] ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()
Previous Message Barry Lind 2003-01-08 21:21:59 Re: ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2003-01-08 21:40:33 Re: synchronized code
Previous Message Barry Lind 2003-01-08 21:21:59 Re: ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()