编码“UTF8”的字符0xe28093在“LATIN1”中没有相等的字符

[英]character 0xe28093 of encoding “UTF8” has no equivalent in “LATIN1”


While inserting some data in a Latin1 Postgres 9.1.3 I get the error:

在Latin1 Postgres 9.1.3中插入一些数据时,我得到的错误是:

character 0xe28093 of encoding "UTF8" has no equivalent in "LATIN1"

编码“UTF8”的字符0xe28093在“LATIN1”中没有相等的字符

The data is being inserted by a Grails application. I've tried the following with no success:

Grails应用程序正在插入数据。我试过以下方法,但没有成功:

  • hibernate { connection.characterEncoding='utf8'}
  • hibernate { connection.characterEncoding = ' use utf8 ' }
  • ?charSet=LATIN1 in the jdbc conn string
  • ? jdbc中的字符集=LATIN1
  • hibernate { connection.charSet='LATIN1'}
  • hibernate { 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.

任何想法?提前谢谢你。

2 个解决方案

#1


4  

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.

如果我理解正确,您的数据库是用“LATIN1”编码创建的。在创建DB之后不能更改此编码。你能改变的唯一一件事是你的客户端和PostgreSQL服务器之间的编码。然后,PostgreSQL服务器尝试在客户端编码和数据库编码之间进行转换。

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.

如果客户机传输无法转换为DB编码的数据,则此过程当然会失败。在您的例子中,Unicode codepoint 2013不能翻译成LATIN1。

This means you have to clean all data going to the database. Fiddling with the client encodings will not help.

这意味着您必须清理所有进入数据库的数据。修改客户端编码不会有帮助。

#2


3  

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).

这是对en破折号的UTF-8编码。latin1字符集中最接近的等效字符是字符代码150 (0x96)。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2012/04/09/6f7ed580f7330958d2fecf60afa959c2.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告