转义字符

利民吧 > 转义字符

[html代码在线转义],[转义后的代码转成HTML代码]。把要转换的代码放到上面的输入框中,点击对应的功能按钮,结果呈现在下面输入框中。

为什么要用转义字符串?

  HTML中<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用。这些符号是不显示在我们最终看到的网页里的,那如果我们希望在网页中显示这些符号,该怎么办呢?

  转义字符串(Escape Sequence)也称字符实体(Character Entity)。在HTML中,定义转义字符串的原因有两个:第一个原因是像“<”和“>”这类符号已经用来表示HTML标签,因此就不能直接当作文本中的符号来使用。为了在HTML文档中使用这些符号,就需要定义它的转义字符串。当解释程序遇到这类字符串时就把它解释为真实的字符。在输入转义字符串时,要严格遵守字母大小写的规则。第二个原因是,有些字符在ASCII字符集中没有定义,因此需要使用转义字符串来表示。

工具简介

  HTML在线转义工具,可以把HTML代码转义后输出,提供html转义字符表对照。

转义字符

所有的ASCII码都可以用“\”加数字(一般是8进制数字)来表示。而C中定义了一些字母前加"\"来表示常见的那些不能显示的ASCII字符,如\0,\t,\n等,就称为转义字符,因为后面的字符,都不是它本来的ASCII字符意思了。

转义字符意义ASCII码值(十进制)
\a响铃(BEL)007
\b退格(BS) ,将当前位置移到前一列008
\f换页(FF),将当前位置移到下页开头012
\n换行(LF) ,将当前位置移到下一行开头010
\r回车(CR) ,将当前位置移到本行开头013
\t水平制表(HT) (跳到下一个TAB位置)009
\v垂直制表(VT)011
\\代表一个反斜线字符''\'092
\'代表一个单引号(撇号)字符039
\"代表一个双引号字符034
\?代表一个问号063
\0空字符(NUL)000
\ddd1到3位八进制数所代表的任意字符三位八进制
\xhh十六进制所代表的任意字符十六进制

转义字符串

转义字符串(Escape Sequence)也称字符实体(Character Entity)。在HTML中,定义转义字符串的原因有两个:第一个原因是像“<”和“>”这类符号已经用来表示HTML标签,因此就不能直接当做文本中的符号来使用。为了在HTML文档中使用这些符号,就需要定义它的转义字符串。当解释程序遇到这类字符串时就把它解释为真实的字符。在输入转义字符串时,要严格遵守字母大小写的规则。第二个原因是,有些字符在ASCII字符集中没有定义,因此需要使用转义字符串来表示。

转义字符串(Escape String),即字符实体(Character Entity)分成三部分:第一部分是一个&符号,英文叫ampersand;第二部分是实体(Entity)名字或者是#加上实体(Entity)编号;第三部分是一个分号。

比如,要显示小于号(<),就可以写 < 或者 < 。

用实体(Entity)名字的好处是比较好理解,一看lt,大概就猜出是less than的意思,但是其劣势在于并不是所有的浏览器都支持最新的Entity名字。而实体(Entity)编号,各种浏览器都能处理。

提示:实体名称(Entity)是区分大小写的。

备注:同一个符号,可以用“实体名称”和“实体编号”两种方式引用,“实体名称”的优势在于便于记忆,但不能保证所有的浏览器都能顺利识别它,而“实体编号”则没有这种担忧,但它实在不方便记忆。

7 比特 可显示的 ASCII 代码

字符描述实体编号
 space&#32;
!exclamation mark&#33;
"quotation mark&#34;
#number sign&#35;
$dollar sign&#36;
%percent sign&#37;
&ampersand&#38;
'apostrophe&#39;
(left parenthesis&#40;
)right parenthesis&#41;
*asterisk&#42;
+plus sign&#43;
,comma&#44;
-hyphen&#45;
.period&#46;
/slash&#47;
0digit 0&#48;
1digit 1&#49;
2digit 2&#50;
3digit 3&#51;
4digit 4&#52;
5digit 5&#53;
6digit 6&#54;
7digit 7&#55;
8digit 8&#56;
9digit 9&#57;
:colon&#58;
;semicolon&#59;
<less-than&#60;
=equals-to&#61;
>greater-than&#62;
?question mark&#63;
@at sign&#64;
Auppercase A&#65;
Buppercase B&#66;
Cuppercase C&#67;
Duppercase D&#68;
Euppercase E&#69;
Fuppercase F&#70;
Guppercase G&#71;
Huppercase H&#72;
Iuppercase I&#73;
Juppercase J&#74;
Kuppercase K&#75;
Luppercase L&#76;
Muppercase M&#77;
Nuppercase N&#78;
Ouppercase O&#79;
Puppercase P&#80;
Quppercase Q&#81;
Ruppercase R&#82;
Suppercase S&#83;
Tuppercase T&#84;
Uuppercase U&#85;
Vuppercase V&#86;
Wuppercase W&#87;
Xuppercase X&#88;
Yuppercase Y&#89;
Zuppercase Z&#90;
[left square bracket&#91;
\backslash&#92;
]right square bracket&#93;
^caret&#94;
_underscore&#95;
`grave accent&#96;
alowercase a&#97;
blowercase b&#98;
clowercase c&#99;
dlowercase d&#100;
elowercase e&#101;
flowercase f&#102;
glowercase g&#103;
hlowercase h&#104;
ilowercase i&#105;
jlowercase j&#106;
klowercase k&#107;
llowercase l&#108;
mlowercase m&#109;
nlowercase n&#110;
olowercase o&#111;
plowercase p&#112;
qlowercase q&#113;
rlowercase r&#114;
slowercase s&#115;
tlowercase t&#116;
ulowercase u&#117;
vlowercase v&#118;
wlowercase w&#119;
xlowercase x&#120;
ylowercase y&#121;
zlowercase z&#122;
{left curly brace&#123;
|vertical bar&#124;
}right curly brace&#125;
~tilde&#126;

7 比特 设备控制 ASCII代码

ASCII设备控制代码最初被设计为用来控制诸如打印机和磁带驱动器之类的硬件设备。在HTML文档中这些代码不会起任何作用。

字符描述实体编号
NULnull character&#00;
SOHstart of header&#01;
STXstart of text&#02;
ETXend of text&#03;
EOTend of transmission&#04;
ENQenquiry&#05;
ACKacknowledge&#06;
BELbell (ring)&#07;
BSbackspace&#08;
HThorizontal tab&#09;
LFline feed&#10;
VTvertical tab&#11;
FFform feed&#12;
CRcarriage return&#13;
SOshift out&#14;
SIshift in&#15;
DLEdata link escape&#16;
DC1device control 1&#17;
DC2device control 2&#18;
DC3device control 3&#19;
DC4device control 4&#20;
NAKnegative acknowledge&#21;
SYNsynchronize&#22;
ETBend transmission block&#23;
CANcancel&#24;
EMend of medium&#25;
SUBsubstitute&#26;
ESCescape&#27;
FSfile separator&#28;
GSgroup separator&#29;
RSrecord separator&#30;
USunit separator&#31;
DELdelete (rubout)&#127;

带有实体名称的 ASCII 实体

字符描述实体名称实体编号
"quotation mark&quot;&#34;
'apostrophe &apos;&#39;
&ampersand&amp;&#38;
<less-than&lt;&#60;
>greater-than&gt;&#62;

ISO 8859-1 符号实体

字符描述实体名称实体编号
 non-breaking space&nbsp;&#160;
¡inverted exclamation mark&iexcl;&#161;
¢cent&cent;&#162;
£pound&pound;&#163;
¤currency&curren;&#164;
¥yen&yen;&#165;
¦broken vertical bar&brvbar;&#166;
§section&sect;&#167;
¨spacing diaeresis&uml;&#168;
©copyright&copy;&#169;
ªfeminine ordinal indicator&ordf;&#170;
«angle quotation mark (left)&laquo;&#171;
¬negation&not;&#172;
­soft hyphen&shy;&#173;
®registered trademark&reg;&#174;
¯spacing macron&macr;&#175;
°degree&deg;&#176;
±plus-or-minus &plusmn;&#177;
²superscript 2&sup2;&#178;
³superscript 3&sup3;&#179;
´spacing acute&acute;&#180;
µmicro&micro;&#181;
paragraph&para;&#182;
·middle dot&middot;&#183;
¸spacing cedilla&cedil;&#184;
¹superscript 1&sup1;&#185;
ºmasculine ordinal indicator&ordm;&#186;
»angle quotation mark (right)&raquo;&#187;
¼fraction 1/4&frac14;&#188;
½fraction 1/2&frac12;&#189;
¾fraction 3/4&frac34;&#190;
¿inverted question mark&iquest;&#191;
×multiplication&times;&#215;
÷division&divide;&#247;

ISO 8859-1 字符实体

字符描述实体名称实体编号
Àcapital a, grave accent&Agrave;&#192;
Ácapital a, acute accent&Aacute;&#193;
Âcapital a, circumflex accent&Acirc;&#194;
Ãcapital a, tilde&Atilde;&#195;
Äcapital a, umlaut mark&Auml;&#196;
Åcapital a, ring&Aring;&#197;
Æcapital ae&AElig;&#198;
Çcapital c, cedilla&Ccedil;&#199;
Ècapital e, grave accent&Egrave;&#200;
Écapital e, acute accent&Eacute;&#201;
Êcapital e, circumflex accent&Ecirc;&#202;
Ëcapital e, umlaut mark&Euml;&#203;
Ìcapital i, grave accent&Igrave;&#204;
Ícapital i, acute accent&Iacute;&#205;
Îcapital i, circumflex accent&Icirc;&#206;
Ïcapital i, umlaut mark&Iuml;&#207;
Ðcapital eth, Icelandic&ETH;&#208;
Ñcapital n, tilde&Ntilde;&#209;
Òcapital o, grave accent&Ograve;&#210;
Ócapital o, acute accent&Oacute;&#211;
Ôcapital o, circumflex accent&Ocirc;&#212;
Õcapital o, tilde&Otilde;&#213;
Öcapital o, umlaut mark&Ouml;&#214;
Øcapital o, slash&Oslash;&#216;
Ùcapital u, grave accent&Ugrave;&#217;
Úcapital u, acute accent&Uacute;&#218;
Ûcapital u, circumflex accent&Ucirc;&#219;
Ücapital u, umlaut mark&Uuml;&#220;
Ýcapital y, acute accent&Yacute;&#221;
Þcapital THORN, Icelandic&THORN;&#222;
ßsmall sharp s, German&szlig;&#223;
àsmall a, grave accent&agrave;&#224;
ásmall a, acute accent&aacute;&#225;
âsmall a, circumflex accent&acirc;&#226;
ãsmall a, tilde&atilde;&#227;
äsmall a, umlaut mark&auml;&#228;
åsmall a, ring&aring;&#229;
æsmall ae&aelig;&#230;
çsmall c, cedilla&ccedil;&#231;
èsmall e, grave accent&egrave;&#232;
ésmall e, acute accent&eacute;&#233;
êsmall e, circumflex accent&ecirc;&#234;
ësmall e, umlaut mark&euml;&#235;
ìsmall i, grave accent&igrave;&#236;
ísmall i, acute accent&iacute;&#237;
îsmall i, circumflex accent&icirc;&#238;
ïsmall i, umlaut mark&iuml;&#239;
ðsmall eth, Icelandic&eth;&#240;
ñsmall n, tilde&ntilde;&#241;
òsmall o, grave accent&ograve;&#242;
ósmall o, acute accent&oacute;&#243;
ôsmall o, circumflex accent&ocirc;&#244;
õsmall o, tilde&otilde;&#245;
ösmall o, umlaut mark&ouml;&#246;
øsmall o, slash&oslash;&#248;
ùsmall u, grave accent&ugrave;&#249;
úsmall u, acute accent&uacute;&#250;
ûsmall u, circumflex accent&ucirc;&#251;
üsmall u, umlaut mark&uuml;&#252;
ýsmall y, acute accent&yacute;&#253;
þsmall thorn, Icelandic&thorn;&#254;
ÿsmall y, umlaut mark&yuml;&#255;

HTML 支持的数学符号

字符描述实体名称实体编号
for all&forall;&#8704;
part&part;&#8706;
exists&exists;&#8707;
empty&empty;&#8709;
nabla&nabla;&#8711;
isin&isin;&#8712;
notin&notin;&#8713;
ni&ni;&#8715;
prod&prod;&#8719;
sum&sum;&#8721;
minus&minus;&#8722;
lowast&lowast;&#8727;
square root&radic;&#8730;
proportional to&prop;&#8733;
infinity&infin;&#8734;
angle&ang;&#8736;
and&and;&#8743;
or&or;&#8744;
cap&cap;&#8745;
cup&cup;&#8746;
integral&int;&#8747;
therefore&there4;&#8756;
simular to&sim;&#8764;
approximately equal&cong;&#8773;
almost equal&asymp;&#8776;
not equal&ne;&#8800;
equivalent&equiv;&#8801;
less or equal&le;&#8804;
greater or equal&ge;&#8805;
subset of&sub;&#8834;
superset of&sup;&#8835;
not subset of&nsub;&#8836;
subset or equal&sube;&#8838;
superset or equal&supe;&#8839;
circled plus&oplus;&#8853;
cirled times&otimes;&#8855;
perpendicular&perp;&#8869;
dot operator&sdot;&#8901;

HTML 支持的希腊字母

字符描述实体名称实体编号
ΑAlpha&Alpha;&#913;
ΒBeta&Beta;&#914;
ΓGamma&Gamma;&#915;
ΔDelta&Delta;&#916;
ΕEpsilon&Epsilon;&#917;
ΖZeta&Zeta;&#918;
ΗEta&Eta;&#919;
ΘTheta&Theta;&#920;
ΙIota&Iota;&#921;
ΚKappa&Kappa;&#922;
ΛLambda&Lambda;&#923;
ΜMu&Mu;&#924;
ΝNu&Nu;&#925;
ΞXi&Xi;&#926;
ΟOmicron&Omicron;&#927;
ΠPi&Pi;&#928;
ΡRho&Rho;&#929;
ΣSigma&Sigma;&#931;
ΤTau&Tau;&#932;
ΥUpsilon&Upsilon;&#933;
ΦPhi&Phi;&#934;
ΧChi&Chi;&#935;
ΨPsi&Psi;&#936;
ΩOmega&Omega;&#937;
αalpha&alpha;&#945;
βbeta&beta;&#946;
γgamma&gamma;&#947;
δdelta&delta;&#948;
εepsilon&epsilon;&#949;
ζzeta&zeta;&#950;
ηeta&eta;&#951;
θtheta&theta;&#952;
ιiota&iota;&#953;
κkappa&kappa;&#954;
λlambda&lambda;&#923;
μmu&mu;&#956;
νnu&nu;&#925;
ξxi&xi;&#958;
οomicron&omicron;&#959;
πpi&pi;&#960;
ρrho&rho;&#961;
ςsigmaf&sigmaf;&#962;
σsigma&sigma;&#963;
τtau&tau;&#964;
υupsilon&upsilon;&#965;
φphi&phi;&#966;
χchi&chi;&#967;
ψpsi&psi;&#968;
ωomega&omega;&#969;
ϑtheta symbol&thetasym;&#977;
ϒupsilon symbol&upsih;&#978;
ϖpi symbol&piv;&#982;

HTML 支持的其他实体

字符描述实体名称实体编号
Œcapital ligature OE&OElig;&#338;
œsmall ligature oe&oelig;&#339;
Šcapital S with caron&Scaron;&#352;
šsmall S with caron&scaron;&#353;
Ÿcapital Y with diaeres&Yuml;&#376;
ƒf with hook&fnof;&#402;
ˆmodifier letter circumflex accent&circ;&#710;
˜small tilde&tilde;&#732;
en space&ensp;&#8194;
em space&emsp;&#8195;
thin space&thinsp;&#8201;
zero width non-joiner&zwnj;&#8204;
zero width joiner&zwj;&#8205;
left-to-right mark&lrm;&#8206;
right-to-left mark&rlm;&#8207;
en dash&ndash;&#8211;
em dash&mdash;&#8212;
left single quotation mark&lsquo;&#8216;
right single quotation mark&rsquo;&#8217;
single low-9 quotation mark&sbquo;&#8218;
left double quotation mark&ldquo;&#8220;
right double quotation mark&rdquo;&#8221;
double low-9 quotation mark&bdquo;&#8222;
dagger&dagger;&#8224;
double dagger&Dagger;&#8225;
bullet&bull;&#8226;
horizontal ellipsis&hellip;&#8230;
per mille &permil;&#8240;
minutes&prime;&#8242;
seconds&Prime;&#8243;
single left angle quotation&lsaquo;&#8249;
single right angle quotation&rsaquo;&#8250;
overline&oline;&#8254;
euro&euro;&#8364;
trademark&trade;&#8482;
left arrow&larr;&#8592;
up arrow&uarr;&#8593;
right arrow&rarr;&#8594;
down arrow&darr;&#8595;
left right arrow&harr;&#8596;
carriage return arrow&crarr;&#8629;
left ceiling&lceil;&#8968;
right ceiling&rceil;&#8969;
left floor&lfloor;&#8970;
right floor&rfloor;&#8971;
lozenge&loz;&#9674;
spade&spades;&#9824;
club&clubs;&#9827;
heart&hearts;&#9829;
diamond&diams;&#9830;
用手机扫一扫访问本站
利民吧文章数据均来自于互联网,版权归原作者所有。如有侵犯您权利的资源,请联系我们处理。
Copyright © 2016-2022 利民吧 版权所有