[英]Scandic letters with UTF-8 are not working in JSF-MYSQL-PrimeFaces-software?
I am outside like snowman in the winter. 冬天我像雪人一样在外面。 I set ALTER SCHEMA
happyend
DEFAULT CHARACTER SET utf8 ; 我设置了ALTER SCHEMA
happyend
DEFAULT CHARACTER SET utf8; to my MySQL DB. 到我的MySQL数据库。
In my xhtml-page: 在我的xhtml页面中:
<?xml version='1.0' encoding='UTF-8' ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
I have problems with scandic letters like ÄÖÅ. 我遇到诸如ÄÖÅ之类的丑字母。 If I insert them straight to db, everything is working fine even I watch that property from the form in web browser they are ok.
如果我将它们直接插入db,那么即使我从Web浏览器中的表单中看到该属性,一切都可以正常工作。 BUT if edit the property in the web browser, then they are like that: ÃÃÃÃÃÃÃÃÂ.
但是,如果在Web浏览器中编辑属性,则它们是这样的:ÃÃÃÃÃÃÃÃÃÂÂ。 Is this something with validation or what the heck is doing that.
这是带有验证的东西,还是到底是做什么的。 I have tried to figure that out two days now and I have no idea anymore.
我试图弄清楚现在两天了,我再也不知道了。
Please try following code to insert data in database. 请尝试以下代码在数据库中插入数据。
create database using "create database databasename default charset utf8 collate utf8_bin;" 使用“创建数据库数据库名称默认字符集utf8整理utf8_bin”来创建数据库;
String unicode= "?useUnicode=yes&characterEncoding=UTF-8";
Class.forName("com.mysql.jdbc.Driver");
PreparedStatement p1=null;
cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/jsfdb"+unicode, "root", "root");
it will surely work. 它肯定会工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.