| The Code is as follows: |
|
|
<Connectorport = "8080" protocol = "HTTP/1.1"
ConnectionTimeout = "20000"
RedirectPort = "8443" type = "regxph" text = "yourobjectname"/>
<Connector port = "8080" protocol = "HTTP/1.1"
ConnectionTimeout = "20000"
RedirectPort = "8443" type = "regxph" text = "yourobjectname"/>
Changed:
Xml Code
<Connectorport = "8080" protocol = "HTTP/1.1"
ConnectionTimeout = "20000"
RedirectPort = "8443" URIEncoding = "UTF-8"/>
<Connector port = "8080" protocol = "HTTP/1.1"
ConnectionTimeout = "20000"
RedirectPort = "8443" URIEncoding = "UTF-8"/> |
If the tomcat front-end has Apache or Nginx forwarding, you also need:
| The Code is as follows: |
|
|
Xml Code
<Connectorport = "8009" protocol = "AJP/1.3" redirectPort = "8443"/>
<Connector port = "8009" protocol = "AJP/1.3" redirectPort = "8443"/>
Changed:
Xml Code
<Connectorport = "8009" protocol = "AJP/1.3" redirectPort = "8443" URIEncoding = "UTF-8"/>
<Connector port = "8009" protocol = "AJP/1.3" redirectPort = "8443" URIEncoding = "UTF-8"/> |
======================
Chinese url garbled characters here describes a solution that can be used in any application deployment environment. This method consists of two steps:
1. Use the escape (encodeURIComponent (fieldValue) method to encode the code on the client. For example:
| The Code is as follows: |
|
|
Title = escape (encodeURIComponent (title); // This is a function in js.
Url = "<% = request. getContextPath () %>/print/printList! PrintTable. action? Title = "+ title; |
2, in the server with java.net. URLDecoder. decode (getRequest (). getParameter ("title"), "UTF-8"), decoding.
To transmit Chinese Characters in these two URLs, the url must be encoded and decoded.
| The Code is as follows: |
|
|
Encoding: encodeURI ("string containing Chinese characters "))
Decoding: java.net. URLDecoder. decode ("the string to be decoded", "UTF-8 "); |
JSP page garbled characters generally only need to use the following code to specify character set encoding at the beginning of the page. If not, use the following sentence for conversion.
| The Code is as follows: |
|
|
Str = new String (str. getBytes ("ISO-8859-1"), "page encoding method "); |
JAVA is used in network transmission encoding is "ISO-8859-1", so in the output need to be converted, such:
| The Code is as follows: |
|
|
String str = new String (str. getBytes ("Development Environment Code"), "ISO-8859-1 "); |
The Network-Encoded chinese character must be similar
| The Code is as follows: |
|
|
Stirng str = new String (str. getBytes ("ISO-8859-1"), "Development Environment encoding "); |