CodeWeblog.com » string name,quot,utf 8 » javascript URL encoding encode

javascript URL encoding encode

java. io. CharConversionException: isHexDigit. make the time pass parameters ajax experience this anomaly, in-line to find a solution that I have not found that errors are caused by escape.

Issued the following solution to put

Another way to thank the Friends provide forget who are you a thank you but

var url = "b.jsp? name =" + escape (u_name);

Services client access:

String name = request.getParameter ( "name");
name = new String (name.getBytes ( "iso-8859-1"));
System.out.println (name);

The results are always error: org.apache.tomcat.util.http.Parameters processParameters
Warning: Parameters: Character decoding failed. Parameter skipped.
java. io. CharConversionException: isHexDigit.

I know that string are abnormal, but do not know how to improve our communication.

Escapse later learned that the problem is, they start looking for information on the. Finally resolved.

Under the first change url:

var url = "b.jsp? name =" + u_name;
url = encodeURI (url);
url = encodeURI (url); / / Writing a not. If one is to write? ? ? ? No..
/ / Writing 2, then output this% df% a4 Medium.

Services client access:

String name = request.getParameter ( "name");
name = java. net.URLDecoder.decode (name, "UTF-8"); / / this statement must be, because if we do not write / / if encoding is% E5% A6% 88% System.out.println (name);









Ajax to do when passing parameters encountered in this abnormality, in-line to find the N-day thing, or did not find an answer that I have not found that errors are caused by escape. Writing is my way of
var url = "b.jsp? name =" + escape (u_name);

Services client access:
String name = request.getParameter ( "name");
name = new String (name.getBytes ( "iso-8859-1"));
System.out.println (name);

The results are always error: org.apache.tomcat.util.http.Parameters processParameters
Warning: Parameters: Character decoding failed. Parameter skipped.
java . io.CharConversionException: isHexDigit.

I know that string are abnormal, but do not know how to improve our communication.
Escapse later learned that the problem is, they start looking for information on the. Finally resolved.

Under the first change url:



  var url = "b.jsp?name=" +u_name;
   url=encodeURI(url); //写一个不行。如果写一个就是????号。
   url=encodeURI(url);  //写2个,则输出 %df%a4这中.        
   searchReq.open("GET", url, true);

====
Of course, in the JSP page can also be written JAVA Code, such as: URLEncoder.encode (mg);



String name=request.getParameter("name");
name = java.net.URLDecoder.decode(name,"UTF-8");   //这句话一定要,因为如果不写的话,编码 就 是%E5%A6%88%
System.out.println(name);





Digg Technorati StumbleUpon Mixx del.icio.us Reddit BlinkList Furl YahooMyWeb feedburner

Tags: string name (RSS), quot (RSS), utf 8 (RSS), anomaly (RSS), parameters (RSS), jsp (RSS), url url (RSS), ajax (RSS), apache tomcat (RSS), iso 8859 (RSS), javascript url (RSS), change url (RSS), url encoding (RSS), client access (RSS), abnormality (RSS), df (RSS)

Permalink: http://www.codeweblog.com/javascript-url-encoding-encode/

Leave a reply