Reputation: 1092
While inserting some data in a Latin1 Postgres 9.1.3 I get the error:
character 0xe28093 of encoding "UTF8" has no equivalent in "LATIN1"
The data is being inserted by a Grails application. I've tried the following with no success:
hibernate { connection.characterEncoding='utf8'}
?charSet=LATIN1
in the jdbc conn stringhibernate { connection.charSet='LATIN1'}
The database were created with:
CREATE DATABASE mydb
WITH OWNER = postgres
ENCODING = 'LATIN1'
TABLESPACE = pg_default
LC_COLLATE = 'C'
LC_CTYPE = 'C'
CONNECTION LIMIT = -1;
Any idea? Thank you in advance.
Upvotes: 1
Views: 8176
Reputation: 118605
That is the UTF-8 encoding for the en dash symbol. The closest equivalent in the latin1 character set would be character code 150 (0x96).
Upvotes: 3
Reputation: 66263
If I understand you correctly your database has been created with the encoding "LATIN1". This encoding cannot be changed after the DB has been created. The only thing you can change - as shown by your bullet points - is the encoding between your client and the PostgreSQL server. The PostgreSQL server then tries to translate between the client encoding and the database encoding.
This process of course fails if when the client transmits data which cannot be translated into the DB encoding. In your case the Unicode codepoint 2013 cannot be translated into LATIN1.
This means you have to clean all data going to the database. Fiddling with the client encodings will not help.
Upvotes: 4