\"???\"my database is Mysql and my table is UTF-8 . 开发者_如何学C" />
开发者

Unicode in Java EE and save question mark in database

开发者 https://www.devze.com 2023-01-03 10:19 出处:网络
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 . 开发者_如何学C

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 . 开发者_如何学C 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?


I think that you need to set the following parameters in your connection 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
0

精彩评论

暂无评论...
验证码 换一张
取 消