简体   繁体   English

在MySQL中存储特殊字符

[英]Storing Special Character in MySQL

I am using mysql query browser to store the following names in the Person table which contains fields of personNumber and personName. 我正在使用mysql查询浏览器将以下名称存储在Person表中,该表包含personNumber和personName字段。 I have the character set of personName at utf-8 and if i insert the name via query browse the query is running correctly but when i try that via JDBC or JPA, the name's special characters become the '?'. 我在utf-8处设置了personName字符集,如果我通过查询浏览器插入名称,查询将正确运行,但是当我尝试通过JDBC或JPA进行尝试时,名称的特殊字符将变为“?”。 What is the problem here?... 这里有什么问题?...

The names are 1.Năstase 2.Hrustanović 3.Ogris-Martič and some similar names. 名字是1.Năstase2.Hrustanović3.Ogris-Martič和一些类似的名字。

您是否正确设置了连接字符串?

jdbc:mysql://localhost:3306/administer?characterEncoding=utf8

试试这个代码

jdbc:mysql://localhost:3306/MY_DB?useUnicode=yes&characterEncoding=UTF8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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