当我用Hibernate获取数据库中的实体时,返回的字符串编码很差。数据库是Oracle 11g。休眠返回错误编码的字符串
例子: 2015.2 Ajout d’un point de contrôle
返回为:
2015.2 Ajout d\u0092un point de contrôle
我在hibernate.cfg.xml中尝试了一些设置:
<property name="hibernate.connection.defaultNChar">true</property>
<property name="hibernate.connection.useUnicode">true</property>
<property name="hibernate.connection.CharSet">utf-16</property>
<property name="hibernate.connection.characterEncoding">utf-16</property>
但没有成功。
这里是数据库设置:
NLS_CHARACTERSET WE8MSWIN1252
NLS_NCHAR_CHARACTERSET AL16UTF16
包含数据行被描述为VARCHAR2(255个字节)
我能做些什么,以一个正确编码字符串返回给我实体 ?
为什么使用“智能报价”而不是普通报价? – fge 2015-02-10 09:47:23
此数据是由我的系统中引用的另一个用户创建的文件名。我没有权力执行文件名策略。 – madgangmixers 2015-02-10 09:57:19