Java handles special characters in URLs, such as &,% ... ) URL (Uniform resoure Locator, Uniform Resource Locator) is a flag for unified targeting and management of resources in the Internet. A complete URL includes the following: 1. Apply the protocol name, including the Http,ftp,file and other flags 2. Resource positioning, is by (.) Split Network Path 3. Port number, as specified, the HTTP application port is the 80,telnet protocol application ports are 23. 4. File path 5 in the server. The encoding location URL in the file does not display some special symbols, so it is time to use the encoding. The encoded format is: A percent semicolon followed by the ASCII (16 binary) code value of the corresponding character. For example, the encoded value of a space is "%20". (ASCII reference) some characters have special meanings in the URL, and the basic encoding rules are as follows: special meaning hexadecimal value 1.+ denotes spaces (spaces cannot be used in URLs)%20 2./separates directories and subdirectories%2f 3.? Separates the actual URLs and parameters%3f 4.% specifies special characters%25 5.# represents the delimiter between the parameters specified in the bookmark%23 6.& URL%26 encoding and decoding functions for URLs in Java
Java.net.URLEncoder.encode (String s)
Java.net.URLDecoder.decode (String s);