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

From: Mauricio Hernández Durán <mhernandez(at)ingenian(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: ERROR: could not convert UTF-8 character 0x00ef to ISO8859-1 possiblesolution
Date: 2005-04-26 16:12:15
Message-ID: 426E685F.1020600@ingenian.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
mhernandez.vcf text/x-vcard 406 bytes

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Youngstrom 2005-04-26 16:58:33 JDBC Driver Modifies Calendar passed into setTimestamp() creates problem with Hibernate
Previous Message Antony Paul 2005-04-26 13:24:29 Impact of open ResultSets and PreparedStatements ?