Special character handling notes in URLs

Source: Internet
Author: User

Special characters in the URL
Some symbols cannot be passed directly in the URL, and if you want to pass these special symbols in the URL, they will be encoded. The encoded format is: The ASCII code of the% plus character, which is a percent percent, followed by the ASCII (16-binary) code value of the corresponding character. For example, the encoded value of a space is "%20".
Some URL special symbols and codes are listed in the following table.
: Replaced by%3a

Hexadecimal value
1. + URL + sign for space%2b
2. Spaces in the space URL can be used with the + number or code%20
3./separate directories and subdirectories%2f
4.? Separating the actual URLs and parameters%3f
5.% Specify special characters%25
6. # means bookmark%23
7. The delimiter between the parameters specified in the & URL%26
8. = value of the specified parameter in the URL%3d

9.{%7b

Ten.}%7d

Example: To pass the string "This%is#te=st&o k?+/" as the parameter T to te.asp, the URL can be:
TE.ASP?T=THIS%25IS%23TE%3DST%26O%20K%3F%2B%2F or
TE.ASP?T=THIS%25IS%23TE%3DST%26O+K%3F%2B%2F (spaces can be replaced with%20 or +)

Encoding and decoding functions for URLs in Java
Java.net.URLEncoder.encode (string s) and Java.net.URLDecoder.decode (string s);

Encoding and decoding functions for URLs in JavaScript
Escape (string s) and unescape (string s);


Escape of points:. ==> u002e
Escape of Dollar sign: $ ==> u0024
The escape of the symbol of the exponent: ^ ==> u005e
Escape of opening curly brace: {==> u007b
Escape of the left parenthesis: [==> u005b
Escape of the Left parenthesis: (==> u0028
Escape of vertical bars: | ==> u007c
Escape of Right parenthesis:) ==> u0029
Escape of asterisks: * ==> u002a
Escape of the plus sign: + ==> u002b
Escape of question marks:? ==> u003f
Anti-slash escape: ==> u005c

Special character handling notes in URLs

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.