Parse all file encodings and scrambling methods for java php and html

  • 2020-06-19 09:55:32
  • OfStack

Scrambling of php files (e.g. scrambling of a. php files in browser) :
header (" Content - Type: text/html; charset= ES11en-8 ") is set for the web page.
mysql_query("set names ES17en-8 ") to set up the database.

struts in java:
Chinese scrambling problem 1 generally refers to the failure to get the correct Chinese in Action when the request parameter has Chinese. There are two ways to solve this problem in Struts2:
Set pageEncoding= "utf-8" on the PAGE of JSP to avoid Chinese scrambling;
If JSP GBK pageEncoding = "page", then you need to modify struts. i18n. encoding = GBK, in struts. Add the following statement xml modified.


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.i18n.encoding" value="GBK"/>
 ... 
</struts>

The above two methods can solve the Chinese parameters in the POST request, but the Chinese parameters in the GET request cannot be solved. The scrambled code of the Chinese parameters in the GET request needs to be solved by modifying the ES47en. xml file of Tomcat. < Connector port = "8080"... URIEncoding = "GBK" / >


Related articles: