Comparison of escape characters in XML and HTML

1 summary

There are some special characters in both XML and HTML, these special characters cannot be used directly in XML or HTML, if these characters must be used, they should be escaped. Escape characters start with "&" and end with ";".

2 Escape characters commonly used in XML

character

escape character

describe

&

&

and

<

&lt;

Less than sign

>

&gt;

greater than sign

"

&quot;

Double quotes

'

&apos;

apostrophe

3 escape characters commonly used in HTML

character

escape character

describe

&

&

and

<

<

Less than sign

>

>

greater than sign

"

"

Double quotes

&nbsp;

space

©

&copy;

copyright symbol

®

&reg;

Registrar

4 Escape characters can be expressed in the following unified format

character

escape character

describe

"

" or "

Double quotes

'

' or '

apostrophe

&

& or &

and symbol

<

< 或 <

Less than sign

>

> or >

greater than sign

@

&#64

at symbol

©

© or ©

copyright

®

® or ®

Trademark

&#8482;

trademark

¥

¥或 ¥

RMB

&#x0020;

space

\t

&#x0009;

Tab

\r

&#x000D;

carriage return

\n

&#x000A;

new line

Guess you like

Origin blog.csdn.net/qq_37284798/article/details/129518069