2013-11-21 22 views
0

不知何故,我的html頁面有​ - Zero width space字符,我將它發送到DB以存儲在一列中。SQL無法插入零寬度空間char

現在,而其他數據庫實例拋出錯誤

incorrect string value \xe2\x80\x8b for HEADER column

兩個數據庫的模式和表有排序規則latin 1 - Default,列有排序規則table default我一個DB接受此值。甚至嘗試將列的整理設置爲utf8 - Default Collation - 仍是同樣的問題。

P.S.我正在使用Hibernate進行數據庫操作。

Exception 

org.jboss.resteasy.spi.UnhandledException: org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updateorg.jboss.resteasy.core.SynchronousDispatcher.unwrapException(.... 
root cause 

org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updateorg.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)..... 

java.sql.BatchUpdateException: Incorrect string value: '\xE2\x80\x8B\xE2\x80\x8B...' for column 'LEFT_TEXT' at row 
+0

POST錯誤休眠消息和冬眠進一步澄清日誌.. – BDR

+2

[拉丁1是一個字節字符集(http://stackoverflow.com/questions/12449336/utf-8-vs -latin1)所以一個Unicode符號'&#8203'(這裏是兩個字節)不是來自Latin 1字符集。 – valex

+0

我已經更新了特定列的排序規則到'utf8 - 默認排序規則',但仍然是一個問題 – Akshay

回答

2

好的我得到了這個答案。

雖然我的排序規則是utf8我必須將字符集設置爲utf8

使用alter table schema.table-name convert to character set utf8;