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

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

Joseph Shraibman wrote:
>>
>> In postgres UNICODE means utf8.
>
>
> Which differs from java unicode?
>

Yes. Unicode in java is 16 bit characters (I think the term for this is
UCS2), two bytes for each character, whereas utf8 is a variable length
encoding with characters represented by 1, 2 or 3 bytes.

> 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?

The recommended way to do this would be to dump the contents of the
database, create a new database with the desired character set and then
import the data into that new database. I don't know if changing
pg_database directly would work or not.

--Barry

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Schlegel 2003-01-08 21:57:45 Re: Drop foreign keys
Previous Message Joseph Shraibman 2003-01-08 21:35:15 Re: [JDBC] ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()

Browse pgsql-jdbc by date

  From Date Subject
Next Message Felipe Schnack 2003-01-08 21:47:48 Re: synchronized code
Previous Message Felipe Schnack 2003-01-08 21:43:44 PreparedStatement.close()