HTML character entities (Character Entities) and escaped string (Escape Sequence) (rpm)

Why use escape strings?
HTML, <,>, etc. have a special meaning & (<,>, check for a link, for & escape), can not be used directly. These symbols are not displayed on the page to see where we end up, that if we want to display these symbols on the page, how to do it?

This comes to HTML escaped string (Escape Sequence) a.

Escape string (Escape Sequence), also known as character entities (Character Entity). In the HTML, there are two reasons defined escape character string: The first reason is like "<" and ">" symbols have been used to denote such HTML tags, and therefore can not be used directly as symbols used in the text . In order to use these symbols in an HTML document, you need to define it escaped string. When the interpreter encounters such strings put it interpreted as a real character. When entering escaped string, to strictly abide by the rules of capitalization. The second reason is that some characters in the ASCII character set is not defined, it is necessary to use the escape string to represent.

Escaped string consisting
escape strings (Escape Sequence), i.e. entity character (Character Entity) is divided into three parts:
The first part is: an ampersand, English called ampersand;
second part is: entity (Entity) or the name of # plus entity (entity) number;
the third part is: a semicolon.

For example, to display less than (<), can be written & lt; or & # 60;.

Benefits Entity (Entity) name is easier to understand, to see lt, probably guess is less than the meaning, but the disadvantage is that not all browsers support the latest Entity name. The entity (Entity) number, various browsers can handle.

Tip:
name of the entity (Entity) is case-sensitive.

Note: The
same symbol can be referenced with the "real name" and "real number" two ways,
"the name of the entity" has the advantage of easy to remember, but can not guarantee that all browsers can successfully recognize it, while "real number" there is no such fears, but it is really hard to remember.

How to display blank?
In general, HTML is automatically cut off the excess space. No matter how much space you add, it is seen as a space. For example, you add 10 spaces between words, HTML truncates nine spaces, but one. In order to increase the space on the page, you can use indicates a space.

Common character entities as follows:

JavaScript escape


Programming time to pay attention to the special character of the problems, many problems arise because of the run-time special characters caused.

Note that, since the backslash itself as an escape character, and therefore can not directly type a backslash in the script. If you want to generate a backslash, you must type with two backslash (\).

Android common string

ellipsis ellipsis: & # 8230; 

Dash dashes: & # 8211; 

less-than: & lt; 

greater-than sign: & gt; 

space: & # 160;

Recommended priority to use the character number, to avoid incompatibility problems.
Transfers from CSDN author Mars-xq
description link: https: //blog.csdn.net/sinat_31057219/article/details/77965560

Guess you like

Origin www.cnblogs.com/Jiang-jiang936098227/p/11612362.html