Android handles special characters in URLs

Source: Internet
Author: User

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);

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.