Openfire: Offline UTF-8 encoded messages are not saved correctly


We are using Openfire 3.9.3. Its MySql database uses utf8_persian_ci collation, while 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> ....

      

The problem is offline messages containing Persian characters (UTF-8 encoded) are stored as question mark strings. For example, ุณู„ุงู… (meaning hello in persian) is stored and displayed as ????.

+3


source to share


1 answer


MySQL does not have proper Unicode support, making it difficult to support auxiliary data in non-Western languages. However, the MySQL JDBC driver has a workaround that can be enabled by adding

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

      

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



Note. If the mechanism used to configure the JDBC URL is XML-based, you will need to use an XML character literal and strip the configuration parameters as the ampersand is a reserved character for XML.

Also make sure your DB and tables are utf8 encoded.

+5


source







All Articles