HTML XML Escape symbol Java transform HTML character Java special character escape string

Source: Internet
Author: User
Tags html tags
Why to use an escape string.

<,>,& in HTML has a special meaning (<,> for the link-sign,& for escape) and cannot be used directly. These symbols are not displayed in the pages we eventually see, so what if we want to display them in the Web page?

This is going to be about the HTML escape string (Escape Sequence).

An escape string (Escape Sequence) is also called a character entity (Character Entity). There are two reasons to define an escape string in HTML: The first reason is that symbols such as "<" and ">" are already used to represent HTML tags, so they cannot be used directly as symbols in text. In order to use these symbols in an HTML document, you need to define its escape string. When an interpreter encounters such a string, it interprets it as a real character. When you enter an escape string, strictly follow the rules for letter capitalization. The second reason is that some characters are not defined in the ASCII character set and therefore need to be represented using an escape string. the composition of the escape string

The Escape string (Escape Sequence), that is, the character entity (Character Entity) is divided into three parts: the first part is a & symbol, English is called Ampersand; the second part is the entity (Entity) name or the # Plus entity (Entity) number; The third part is a semicolon.

For example, to display the less than sign (<), you can write &lt; or <.

The advantage of using entity (Entity) name is better understanding, a see LT, probably guess is less than meaning, but its disadvantage is not all browsers support the newest Entity name. The entity (Entity) number can be processed by various browsers.

Tip: Entity names (Entity) are case-sensitive.

Note: The same symbol can be referenced in two ways, "entity name" and "entity number", the advantage of "entity name" is that it is easy to remember, but it is not guaranteed that all browsers can identify it successfully, and "entity number" has no such concern, but it is inconvenient to remember. how to display spaces.

Typically, HTML automatically truncates extra spaces. No matter how many spaces you add, it's considered a space. For example, if you add 10 spaces between two characters, HTML will intercept 9 spaces, leaving only one. In order to add spaces to the page, you can use &nbsp; to represent spaces. HTML Special escape character list the most commonly used character entities
Character entities

Show Description Entity name Entity number
Half a square big blank &ensp;
The whole square big blank &emsp;
Continuous line of blank spaces &nbsp;
< Less than &lt; <
> Greater than &gt; >
& & Symbols &amp; &
" Double quotes &quot; "
© Copyright &copy; ©
® Registered trademarks &reg; ®
Trademarks (USA)
X Multiplication &times; X
÷ Division &divide; ÷
ISO 8859-1 (Latin-1) Character Set

HTML 4.01 supports the ISO 8859-1 (Latin-1) character set.

Note: For convenience, in the following table, "entity name" is referred to as "name", "entity number" is referred to as "number"

Show name number Show name number Show name number Show name number Show name number
&nbsp; ¡ &iexcl; ¡ ¢ &cent; ¢ £ &pound; £ ¤ &curren; ¤
¥ &yen; ¥ ¦ &brvbar; ¦ § &sect; § ¨ &uml; ¨ © &copy; ©
ª &ordf; ª « &laquo; « ¬ &not; ¬ &shy; ® &reg; ®
¯ &macr; ¯ ° &deg; ° ± &plusmn; ± ² &sup2; ² ³ &sup3; ³
´ &acute; ´ µ &micro; µ &para; · &middot; · ¸ &cedil; ¸
¹ &sup1; ¹ º &ordm; º » &raquo; » ¼ &frac14; ¼ ½ &frac12; ½
¾ &frac34; ¾ ¿ &iquest; ¿ À &Agrave; À Á &Aacute; Á Â &Acirc; Â
Coal tar
Related Article

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.