Special Character Handling notes in URLs

Source: Internet
Author: User

Special characters in the URL
Some symbols cannot be directly transmitted in the URL. If you want to pass these special symbols in the URL, you need to use their encoding. The encoding format is % plus the characters' ASCII code, that is, a percent sign %, followed by the corresponding characters' ASCII (hexadecimal) code value. For example, the Space Encoding value is "% 20 ".
The following table lists some special URL symbols and codes.
: Replace with % 3A

      Hexadecimal value
1. + The plus sign in the URL indicates space. % 2B
2. Space Spaces in the URL can be encoded with a plus sign (+ ). % 20
3. / Separate directories and subdirectories % 2f
4. ? Separate actual URLs and Parameters % 3f
5. % Special characters % 25
6. # Indicates bookmarks % 23
7. & Delimiter between parameters specified in the URL % 26
8. = The value of the specified parameter in the URL. % 3d

For example, to pass the string "This % is # Te = sT & o k? +/"Is transmitted to te. ASP as the parameter T. The URL can be:
Te. asp? T = This % 25is % 23te % 3dst % 26o % 20 K % 3f % 2B % 2f or
Te. asp? T = This % 25is % 23te % 3dst % 26o + K % 3f % 2B % 2f (spaces can be replaced by % 20 or +)

URL encoding and decoding functions in Java
Java.net. urlencoder. encode (string S) and java.net. urldecoder. Decode (string S );

URL encoding and decoding functions in Javascript

Escape (string S) and Unescape (string S );

From: http://blog.csdn.net/steven2006/article/details/1931647

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.