html中显示特殊符号(附带特殊字符对应表)

问题重现

在使用html进行编辑的时候,特殊符号往往会显示错误,极端情况下更可能导致网页崩溃。如下面这段代码:

<table>
<tr>
<td>
中_国_人
</td>
</tr>
</table>

1
2
3
4
5
6
7

在网页中则显示为:

html中显示特殊符号(附带特殊字符对应表)-风君雪科技博客

这里将两个下划线自动转化为斜体标识符,导致输出结果有误。

解决方法

这里建议使用字符编码来替换掉原特殊字符,如将上述代码改为:

<table>
<tr>
<td>
中``` |```&#95;``` |国``` |```_``` |人
</td>
</tr>
</table>

1
2
3
4
5
6
7

则输出变为:

html中显示特殊符号(附带特殊字符对应表)-风君雪科技博客

特殊字符对应表

下面附上特殊字符对应表

字符 十进制字符编号 实体名字
! ! 惊叹号Exclamation mark
" &quot; 双引号Quotation mark  
# # 数字标志Number sign
$ $ 美元标志Dollar sign
% % 百分号Percent sign
& & &amp; Ampersand
' 单引号Apostrophe
( ( 小括号左边部分Left parenthesis
) ) 小括号右边部分Right parenthesis
* * 星号Asterisk
+ + 加号Plus sign
, , 逗号Comma
- 连字号Hyphen
. . 句号Period (fullstop)
/ / 斜杠Solidus (slash)
0 0 数字0 Digit 0
1 1 数字1 Digit 1
2 2 数字2 Digit 2
3 3 数字3 Digit 3
4 4 数字4 Digit 4
5 5 数字5 Digit 5
6 6 数字6 Digit 6
7 7 数字7 Digit 7
8 8 数字8 Digit 8
9 9 数字9 Digit 9
: : 冒号Colon
; ; 分号Semicolon
< < &lt; 小于号Less than
= = 等于符号Equals sign
> > &gt; 大于号Greater than
? ? 问号Question mark
@ @ Commercial at
A A 大写A Capital A
B B 大写B Capital B
C C 大写C Capital C
D D 大写D Capital D
E E 大写E Capital E
F F 大写F Capital F
G G 大写G Capital G
H H 大写H Capital H
I I 大写J Capital I
J J 大写K Capital J
K K 大写L Capital K
L L 大写K Capital L
M M 大写M Capital M
N N 大写N Capital N
O O 大写O Capital O
P P 大写P Capital P
Q Q 大写Q Capital Q
R R 大写R Capital R
S S 大写S Capital S
T T 大写T Capital T
U U 大写U Capital U
V V 大写V Capital V
W W 大写W Capital W
X X 大写X Capital X
Y Y 大写Y Capital Y
Z Z 大写Z Capital Z
[ [ 中括号左边部分Left square bracket
\ 反斜杠Reverse solidus (backslash)
] ] 中括号右边部分Right square bracket
^ ^ Caret
_ _ 下划线Horizontal bar (underscore)
` ` 尖重音符Acute accent
a a 小写a Small a
b b 小写b Small b
c c 小写c Small c
d d 小写d Small d
e e 小写e Small e
f f 小写f Small f
g g 小写g Small g
h h 小写h Small h
i i 小写i Small i
j j 小写j Small j
k k 小写k Small k
l l 小写l Small l
m m 小写m Small m
n n 小写n Small n
o o 小写o Small o
p p 小写p Small p
q q 小写q Small q
r r 小写r Small r
s s 小写s Small s
t t 小写t Small t
u u 小写u Small u
v v 小写v Small v
w w 小写w Small w
x x 小写x Small x
y y 小写y Small y
z z 小写z Small z
{ { 大括号左边部分Left curly brace
| | 竖线Vertical bar
} } 大括号右边部分Right curly brace
~ ~ Tilde
 未使用Unused
    &nbsp; 空格Nonbreaking space
¡ ¡ &iexcl; Inverted exclamation
¢ ¢ &cent; 货币分标志Cent sign
£ £ &pound; 英镑标志Pound sterling
¤ ¤ &curren; 通用货币标志General currency sign
¥ ¥ &yen; 日元标
¦ ¦ &brvbar; or &brkbar;“`
§ § &sect; 分节号Section sign
¨ ¨ &uml; or ¨“`
© © &copy; 版权标志Copyright
ª ª &ordf; Feminine ordinal
« « &laquo; Left angle quote, guillemet left
¬ “`¬ ¬ Not sign
“““ ­ &shy; Soft hyphen
® ® &reg; 注册商标标志Registered trademark
¯ ¯ &macr; or &hibar;“`
° ° &deg; 度数标志Degree sign
± ± &plusmn; 加或减Plus or minus
² ² &sup2; 上标2 Superscript two
³ ³ &sup3; 上标3 Superscript three
´ ´ &acute; 尖重音符Acute accent
µ µ &micro; Micro sign
¶ &para; Paragraph sign
· · &middot; Middle dot
¸ ¸ &cedil; Cedilla
¹ ¹ &sup1; 上标1 Superscript one
º º &ordm; Masculine ordinal
» » &raquo; Right angle quote, guillemet right
¼ ¼ &frac14; 四分之一Fraction one-fourth
½ ½ &frac12; 二分之一Fraction one-half
¾ ¾ &frac34; 四分之三Fraction three-fourths
¿ ¿ &iquest; Inverted question mark
À À &Agrave; Capital A, grave accent
Á Á &Aacute; Capital A, acute accent
  &Acirc; Capital A, circumflex
à à &Atilde; Capital A, tilde
Ä Ä &Auml; Capital A, di?esis / umlaut
Å Å &Aring; Capital A, ring
Æ Æ &AElig; Capital AE ligature
Ç Ç &Ccedil; Capital C, cedilla
È È &Egrave; Capital E, grave accent
É É &Eacute; Capital E, acute accent
Ê Ê &Ecirc; Capital E, circumflex
Ë Ë &Euml; Capital E, di?esis / umlaut
Ì Ì &Igrave; Capital I, grave accent
Í Í &Iacute; Capital I, acute accent
Î Î &Icirc; Capital I, circumflex
Ï Ï &Iuml; Capital I, di?esis / umlaut
Ð Ð &ETH; Capital Eth, Icelandic
Ñ Ñ &Ntilde; Capital N, tilde
Ò Ò &Ograve; Capital O, grave accent
Ó Ó &Oacute; Capital O, acute accent
Ô Ô &Ocirc; Capital O, circumflex
Õ Õ &Otilde; Capital O, tilde
Ö Ö &Ouml; Capital O, di?esis / umlaut
× × &times; 乘号Multiply sign
Ø Ø &Oslash; Capital O, slash
Ù Ù &Ugrave; Capital U, grave accent
Ú Ú &Uacute; Capital U, acute accent
Û Û &Ucirc; Capital U, circumflex
Ü Ü &Uuml; Capital U, di?esis / umlaut
Ý Ý &Yacute; Capital Y, acute accent
Þ Þ &THORN; Capital Thorn, Icelandic
ß ß &szlig; Small sharp s, German sz
à à &agrave; Small a, grave accent
á á &aacute; Small a, acute accent
â â &acirc; Small a, circumflex
ã ã &atilde; Small a, tilde
ä ä &auml; Small a, di?esis / umlaut
å å &aring; Small a, ring
æ æ &aelig; Small ae ligature
ç ç &ccedil; Small c, cedilla
è è &egrave; Small e, grave accent
é é &eacute; Small e, acute accent
ê ê &ecirc; Small e, circumflex
ë ë &euml; Small e, di?esis / umlaut
ì ì &igrave; Small i, grave accent
í í &iacute; Small i, acute accent
î î &icirc; Small i, circumflex
ï ï &iuml; Small i, di?esis / umlaut
ð ð &eth; Small eth, Icelandic
ñ ñ &ntilde; Small n, tilde
ò ò &ograve; Small o, grave accent
ó ó &oacute; Small o, acute accent
ô ô &ocirc; Small o, circumflex
õ õ &otilde; Small o, tilde
ö ö &ouml; Small o, di?esis / umlaut
÷ ÷ &divide; 除号Division sign
ø ø &oslash; Small o, slash
ù ù &ugrave; Small u, grave accent
ú ú &uacute; Small u, acute accent
û û &ucirc; Small u, circumflex
ü ü &uuml; Small u, di?esis / umlaut
ý ý &yacute; Small y, acute accent
þ þ &thorn; Small thorn, Icelandic
ÿ ÿ &yuml; Small y, umlaut