Special characters in a URL or XML document

Source: Internet
Author: User

special characters in the URL

In a query executed on a URL, a special character is specified as %xx, where xx is the hexadecimal value of the character. The following table lists these special characters and describes their meanings. For more information, see the RFC1738 specification in http://www.faqs.org/rfcs/rfc1738.html.


Special characters


Special meaning

Hexadecimal value

+

Represents a space (you cannot use a space in a URL).

%2b

/

Separate directories and subdirectories.

%2f

?

Separates the actual URLs and parameters.

%3f

%

Specifies a special character.

%25

#

Represents a bookmark.

%23

&

The separator between the parameters specified in the URL.

%26

For example, examine the following query:

Because the character has a special meaning in the URL (separating the URL and the passed arguments), the character is encoded as %3fwhen the query is specified in the URL.

The following URL will execute the query. The parameter value is passed in the URL.

The browser escapes all special characters (such as + characters) on the right side (that is, converts the + character on the right side to %20).

special characters in XML

Characters such as > and < are XML markup characters that have special meanings in XML. When you specify these characters in an SQL query (or XPath query),
They must be encoded appropriately (also known as entity encodings). The following table lists these special characters and describes their meanings. For more information, see
The XML 1.0 specification in the XML 1.0 specification.

special characters

/td>

special meaning

entity encoding

> the

Start tag.

&gt;

The

,

.

&lt;

"

" quotes.

&quot;

'

'

Apostrophes.

&apos;

and

"&" characters.

&amp;

For example, examine the following query:

Because the < character has a special meaning in XML, you must encode the character as &gt;when you specify the query in a template (an XML document).
The following is the template that contains the query:

Entity encoding in URL encoding

Sometimes you may need to specify both the URL encoding and the entity encoding. For example, you can specify the following template directly in the URL (instead of specifying a filename):

In this example, the & character in the entity encoding &lt; (specified for < tag characters) has a special meaning in the URL, which needs to be further
Coding. The & character must be encoded as a %26, otherwise it will be treated as a parameter separator in the URL. The URL is then specified as:

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.