PHP files in garbled (such as a.php files in the browser garbled):
The header ("Content-type:text/html;charset=utf-8") is the setting page.
mysql_query ("Set names Utf-8") sets the database.
Struts in Java:
Chinese garbled problem generally refers to when the request parameter has Chinese, cannot get the correct Chinese in the action. There are 2 ways to solve this problem in Struts2:
Set JSP page pageencoding= "Utf-8", will not appear in Chinese garbled;
If the JSP page pageencoding= "GBK", then you need to modify STRUTS.I18N.ENCODING=GBK, add the following statement in the Struts.xml to modify.
Copy the Code code as follows:
"-//apache software foundation//dtd Struts Configuration 2.0//en"
"Http://struts.apache.org/dtds/struts-2.0.dtd" >
......
The above 2 methods can resolve the Chinese parameters in the POST request, but the Chinese parameters in the GET request can not be resolved, the Chinese parameter in GET request is garbled by modifying the Tomcat Server.xml file to resolve, modify the following content, add uriencoding= "GBK" :
http://www.bkjia.com/PHPjc/327821.html www.bkjia.com true http://www.bkjia.com/PHPjc/327821.html techarticle php files in garbled (such as a.php file in the browser garbled): Header ("Content-type:text/html;charset=utf-8") is set up the Web page. mysql_query ("Set names Utf-8") sets the database. ...