Cyrillic letters don't store fine with Glassfish and Mysql

点点圈 提交于 2019-12-24 13:52:39

问题


I am using Glassfish 4.0, JSF 2.2.5, MySQL 5.5 and J Conn 5.1.29. When I enter some Cyrillic letters in a form, they are saved as "ÑдÑдÑÑдÑ" in the database. I have also noticed that if the validation fails in the form, the existing Cyrillic letters in the form are modified to "ÑдÑдÑÑдÑ".

It is working right if I saved them through MySQL Workbench, and they are displayed fine on the web page.

The JSF page is set to UFT-8.

MySQL:

init_connect='SET collation_connection = utf8_unicode_ci' 
init_connect='SET NAMES utf8' 
character-set-server=utf8 
collation-server=utf8_unicode_ci 
skip-character-set-client-handshake

回答1:


The problem was solved when I added the following to the glassfish-web.xml

<parameter-encoding default-charset=”UTF-8″/>


来源:https://stackoverflow.com/questions/22591958/cyrillic-letters-dont-store-fine-with-glassfish-and-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!