Cyrillic letters don't store fine with Glassfi

2019-08-08 20:00发布

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条回答
家丑人穷心不美
2楼-- · 2019-08-08 20:56

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

<parameter-encoding default-charset=”UTF-8″/>
查看更多
登录 后发表回答