ERROR: could not convert UTF-8 character 0x00ef to ISO8859-1 possiblesolution - Mailing list pgsql-jdbc

From Mauricio Hernández Durán
Subject ERROR: could not convert UTF-8 character 0x00ef to ISO8859-1 possiblesolution
Date
Msg-id 426E685F.1020600@ingenian.com
Whole thread Raw
Responses Re: ERROR: could not convert UTF-8 character 0x00ef to ISO8859-1 possiblesolution
List pgsql-jdbc
Hi all!

We encountered the same problem most people have had using latin1 or
unicode for spanish characters upon inserting or updates:

ERROR: could not convert UTF-8 character 0x00ef to ISO8859-1

We checked out the mailing lists and found solutions from people who had
the same problem, we would like to share ours which was basically
We tried the changes proposed by others which consist of:

1. Set the database encoding to UNICODE or LATIN1 ( check this with psql
-l to get a list of the databases and their respective encodings)
2. Set the client connection pool encoding in the connection url:
?charSet=LATIN1
3. Set the charset directive in your JSP's to ISO-8859-1  (LATIN1).

AND

4. Instead of changing the code to work with streams of bytes and their
encoding  as suggested by other postings we  changed the encoding system
property  for the JVM using the -Dfile.encoding=ISO-8859-1 option.

Mind you: since we had no backwards compatibility problems with other
legacy apps running on the server this did the trick for us.

AS a side note: the app worked perfectly on our testing environment
(WIndows XP , Jboss 3.2.3, Postgres 7.4 but not on production (Solaris
8, JBoss 3.2.3, Postgres 7.4) the difference being the default
file.enconding system property.


Hope it helps, comments on this solution are welcome!!

Attachment

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: JDBC Driver Modifies Calendar passed into setTimestamp()
Next
From: Dave Minter
Date:
Subject: CallableStatement problem...?