简体   繁体   中英

Unicode in Java EE and save question mark in database

When I insert persian information using Java EE 6 (JSF and JPA) my information save question mark for example "علی" ===> "???" my database is Mysql and my table is UTF-8 . when insert persian data directly in database is correct and save correct.

I know that with change one property in Java EE my problem go to solved but I don`t know where is it?

我认为您需要在连接URL中设置以下参数:

jdbc:mysql://host:port/db?useUnicode=true&characterEncoding=UTF-8

with change in my.cnf (mysql configure file) in /etc/mysql (linux) and add this 2 tag solved my problem

default-character-set=utf8
default-collation=utf8_persian_ci

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM