Read about how to encode url parameters in java, The latest news, videos, and discussion topics about how to encode url parameters in java from alibabacloud.com
Basic concepts of 1.URL codingURLs can only be sent over the Internet using the US-ASCII character set. Because URLs often contain characters outside of the ASCII collection, URLs must be converted to valid ASCII formats. URL encoding uses a "%"
Complete URL Chinese Encoding
I thought this would work.
Public static string strtourl (string Str ){String result = NULL;Try {Result = urlencoder. encode (STR, "UTF-8"); // gb2312} Catch (unsupportedencodingexception e ){// Todo auto-generated
/* When a form in a webpage is submitted using the POST method, the data content type is application/X-WWW-form-urlencoded. This type will: 1. character "a"-"Z", "a"-"Z", "0"-"9 ",". ","-"," * ", and" _ "are not encoded;2. Convert the space to
Chinese garbled characters of URL parameters in java, and Chinese garbled characters in javaurl
** Do students have various garbled characters when passing parameters through URLs? Passing parameters in a URL is a headache for programmers. Although
1 the URL class in Java2 the Java Network class allows you to implement your application over a network or remote connection. Moreover, the platform is now accessible to the Internet as well as to URL resources. The Java URL class allows access to
Question about passing Chinese Parameters Using URL encoding in JSP When the JSP page uses URL encoding to pass Chinese parameters, garbled characters may occur during Parameter Parsing. Due to Java design considerations to the international problem,
Let's take a look at three urls:
Url1. http://hi.baidu.com/aobao's Yan
Url2. http://hi.baidu.com/%E7%88%B1%E5% AE %9D%E7%9A%84%E5%A6%8D (UTF-8 coding)
Url3. http://hi.baidu.com/%B0% AE %B1%A6%B5%C4%E5%FB (GBK encoding)
These three URLs point
Coding & DecodingThe following figure allows us to find out where there is a transcoding in the Javaweb:
The user wants the server to send an HTTP request, needs to encode the place to have the URL, the cookie, the parameter, after encodes the
The Java Network class allows you to implement your application over a network or remote connection. Moreover, the platform is now accessible to the Internet as well as to URL resources. The Java URL class allows access to network resources just as
Several Methods to handle garbled Chinese parameters of URL links in Java are as follows:
Method 1:
Http://xxx.do? Ptname = 'I am a China'
String strptname = request. getparameter ("ptname ");
Strptname = new string (strptname. getbytes
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.