Openfire:离线UTF-8编码的邮件保存错误 [英] Openfire: Offline UTF-8 encoded messages are saved wrong

查看:70
本文介绍了Openfire:离线UTF-8编码的邮件保存错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我们使用Openfire 3.9.3.其MySql数据库使用utf8_persian_ci归类,在openfire.xml中,我们具有:


We use Openfire 3.9.3. Its MySql database uses utf8_persian_ci collation and in openfire.xml we have:

...<defaultProvider> 
  <driver>com.mysql.jdbc.Driver</driver>  
  <serverURL>jdbc:mysql://localhost:3306/openfire?useUnicode=true&amp;amp;characterEncoding=UTF-8</serverURL>  
  <mysql> 
    <useUnicode>true</useUnicode> 
  </mysql> ....

问题在于,包含波斯字符(UTF-8编码)的脱机消息被另存为问号字符串.例如,存储سلام(波斯语中的你好")并显示为????.

The problem is that offline messages which contain Persian characters (UTF-8 encoded) are saved as strings of question marks. For example سلام (means hello in Persian) is stored and showed like ????.

推荐答案

MySQL没有适当的Unicode支持,这使得以非西方语言支持数据变得困难.但是,MySQL JDBC驱动程序具有一种解决方法,可以通过添加

MySQL does not have proper Unicode support, which makes supporting data in non-Western languages difficult. However, the MySQL JDBC driver has a workaround which can be enabled by adding

?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8

到JDBC驱动程序的URL.您可以编辑conf/openfire.xml文件以添加该值.

to the URL of the JDBC driver. You can edit the conf/openfire.xml file to add this value.

注意:如果用于配置JDBC URL的机制是基于XML的,则需要使用XML字符文字&分隔配置参数,因为&"号是XML的保留字符.

Note: If the mechanism you use to configure a JDBC URL is XML-based, you will need to use the XML character literal & to separate configuration parameters, as the ampersand is a reserved character for XML.

还请确保您的数据库和表具有utf8编码.

Also be sure that your DB and tables have utf8 encoding.

这篇关于Openfire:离线UTF-8编码的邮件保存错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆