Transcoding: ="./?tcontent="+encodeURI(encodeURI(tcontent));
Decoding: ((String)("tcontent"), "UTF-8");
example
source code
Copy the codeThe code is as follows:
<%@ page contentType="text/html; charset=gb2312" language="java" import=".*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Unt titled document</title>
</head>
<body>
<%
String str_test = "Huagong";
%>
<form method=post action="?test=<%=(str_test) %>">
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
source code
Copy the codeThe code is as follows:
<%@ page contentType="text/html; charset=gb2312" language="java" import=".*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Unt titled document</title>
</head>
<body>
<%
String str = new String(("test").getBytes("ISO8859_1"));
%>
<BR>
<%=str %>
</body>
</html>