In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-10-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "html escape characters and then code recognition", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "html escape characters and then code recognition" bar!
Occasionally see characters such as & # 39; in the data, with the following characteristics
Begins with & # and ends with a string of numbers ending with;
Begins with & and ends with a string of characters that ends with
Such as the most common or equivalent
When the browser encounters these escape characters, it will escape back, but how can it be identified by the code? Org.apache.commons.lang.StringEscapeUtils.unescapeHtml provides a good explanation.
In the first case above, the number is in the middle, and the number (unicode) is converted directly into char.
In the second case, there are characters in the middle, so we can only look up the mapping table. Find the number corresponding to the characters in the mapping table and convert it to char. Look at the code at a glance.
See how HTML40 defines it.
Static {
HTML40=newEntities ()
FillWithHtml40Entities (HTML40)
}
StaticvoidfillWithHtml40Entities (Entitiesentities) {
Entities.addEntities (BASIC_ARRAY)
Entities.addEntities (ISO8859_1_ARRAY)
Entities.addEntities (HTML40_ARRAY)
}
Let's see what BASIC_ARRAY, ISO8859_1_ARRAY and HTML40_ARRAY are, respectively.
BASIC_ARRAY
PrivatestaticfinalString [] [] BASIC_ARRAY= {{"quot", "34"}, / / "- double-quote
{"amp", "38"}, / / &-ampersand
{"lt", "60"}, / /-greater-than
}
ISO8859_1_ARRAY
StaticfinalString [] [] ISO8859_1_ARRAY= {{"nbsp", "160"}, / / non-breakingspace
{"iexcl", "161"}, / / invertedexclamationmark
{"cent", "162"}, / / centsign
{"pound", "163"}, / / poundsign
{"curren", "164"}, / / currencysign
{"yen", "165"}, / / yensign=yuansign
{"brvbar", "166"}, / / brokenbar=brokenverticalbar
{"sect", "167"}, / / sectionsign
{"uml", "168"}, / / diaeresis=spacingdiaeresis
{"copy", "169"}, / / copyrightsign
{"ordf", "170"}, / / feminineordinalindicator
{"laquo", "171"}, / / left-pointingdoubleanglequotationmark=leftpointingguillemet
{"not", "172"}, / / notsign
{"shy", "173"}, / / softhyphen=discretionaryhyphen
{"reg", "174"}, / / reg-registeredtrademarksign
{"macr", "175"}, / / macron=spacingmacron=overline=APLoverbar
{"deg", "176"}, / / degreesign
{"plusmn", "177"}, / / plus-minussign=plus-or-minussign
{"sup2", "178"}, / / superscripttwo=superscriptdigittwo=squared
{"sup3", "179"}, / / superscriptthree=superscriptdigitthree=cubed
{"acute", "180"}, / / acuteaccent=spacingacute
{"micro", "181"}, / / microsign
{"para", "182"}, / / pilcrowsign=paragraphsign
{"middot", "183"}, / / middledot=Georgiancomma=Greekmiddledot
{"cedil", "184"}, / / cedilla=spacingcedilla
{"sup1", "185"}, / / superscriptone=superscriptdigitone
{"ordm", "186"}, / / masculineordinalindicator
{"raquo", "187"}, / / right-pointingdoubleanglequotationmark=rightpointingguillemet
{"frac14", "188"}, / / vulgarfractiononequarter=fractiononequarter
{"frac12", "189"}, / / vulgarfractiononehalf=fractiononehalf
{"frac34", "190"}, / / vulgarfractionthreequarters=fractionthreequarters
{"iquest", "191"}, / / invertedquestionmark=turnedquestionmark
{"Agrave", "192"}, / / uppercaseA,graveaccent
{"Aacute", "193"}, / / Aacute-uppercaseA,acuteaccent
{"Acirc", "194"}, / / uppercaseA,circumflexaccent
{"Atilde", "195"}, / / Atilde-uppercaseA,tilde
{"Auml", "196"}, / / uppercaseA,umlaut
{"Aring", "197"}, / / Aring-uppercaseA,ring
{"AElig", "198"}, / / uppercaseAE
{"Ccedil", "199"}, / / uppercaseC,cedilla
{"Egrave", "200"}, / / Egrave-uppercaseE,graveaccent
{"Eacute", "201"}, / / uppercaseE,acuteaccent
{"Ecirc", "202"}, / / uppercaseE,circumflexaccent
{"Euml", "203"}, / / uppercaseE,umlaut
{"Igrave", "204"}, / / uppercaseI,graveaccent
{"Iacute", "205"}, / / uppercaseI,acuteaccent
{"Icirc", "206"}, / / uppercaseI,circumflexaccent
{"Iuml", "207"}, / / uppercaseI,umlaut
{"ETH", "208"}, / / uppercaseEth,Icelandic
{"Ntilde", "209"}, / / uppercaseN,tilde
{"Ograve", "210"}, / / uppercaseO,graveaccent
{"Oacute", "211"}, / / uppercaseO,acuteaccent
{"Ocirc", "212"}, / / uppercaseO,circumflexaccent
{"Otilde", "213"}, / / uppercaseO,tilde
{"Ouml", "214"}, / / Ouml-uppercaseO,umlaut
{"times", "215"}, / / multiplicationsign
{"Oslash", "216"}, / / Oslash-uppercaseO,slash
{"Ugrave", "217"}, / / uppercaseU,graveaccent
{"Uacute", "218"}, / / uppercaseU,acuteaccent
{"Ucirc", "219"}, / / uppercaseU,circumflexaccent
{"Uuml", "220"}, / / uppercaseU,umlaut
{"Yacute", "221"}, / / Yacute-uppercaseY,acuteaccent
{"THORN", "222"}, / / THORN-uppercaseTHORN,Icelandic
{"szlig", "223"}, / / lowercasesharps,German
{"agrave", "224"}, / / lowercasea,graveaccent
{"aacute", "225"}, / / aacute-lowercasea,acuteaccent
{"acirc", "226"}, / / acirc-lowercasea,circumflexaccent
{"atilde", "227"}, / / lowercasea,tilde
{"auml", "228"}, / / lowercasea,umlaut
{"aring", "229"}, / / lowercasea,ring
{"aelig", "230"}, / / lowercaseae
{"ccedil", "231"}, / / please-lowercasec,cedilla
{"egrave", "232"}, / / egrave-lowercasee,graveaccent
{"eacute", "233"}, / / eacute-lowercasee,acuteaccent
{"ecirc", "234"}, / / lowercasee,circumflexaccent
{"euml", "235"}, / / euml-lowercasee,umlaut
{"igrave", "236"}, / / lowercasei,graveaccent
{"iacute", "237"}, / / lowercasei,acuteaccent
{"icirc", "238"}, / / lowercasei,circumflexaccent
{"iuml", "239"}, / / lowercasei,umlaut
{"eth", "240"}, / / eth-lowercaseeth,Icelandic
{"ntilde", "241"}, / / ntilde-lowercasen,tilde
{"ograve", "242"}, / / lowercaseo,graveaccent
{"oacute", "243"}, / / oacute-lowercaseo,acuteaccent
{"ocirc", "244"}, / / ocirc-lowercaseo,circumflexaccent
{"otilde", "245"}, / / otilde-lowercaseo,tilde
{"ouml", "246"}, / / ouml-lowercaseo,umlaut
{"divide", "247"}, / / divisionsign
{"oslash", "248"}, / / oslash-lowercaseo,slash
{"ugrave", "249"}, / / ugrave-lowercaseu,graveaccent
{"uacute", "250"}, / / lowercaseu,acuteaccent
{"ucirc", "251"}, / / ucirc-lowercaseu,circumflexaccent
{"uuml", "252"}, / / uuml-lowercaseu,umlaut
{"yacute", "253"}, / / yacute-lowercasey,acuteaccent
{"thorn", "254"}, / / thorn-lowercasethorn,Icelandic
{"yuml", "255"}, / / lowercasey,umlaut
}
HTML40_ARRAY
StaticfinalString [] [] HTML40_ARRAY= {
/ /
{"fnof", "402"}, / / latinsmallfwithhook=function=florin,U+0192ISOtech-- >
/ /
{"Alpha", "913"}, / / greekcapitalletteralpha,U+0391-- >
{"Beta", "914"}, / / greekcapitalletterbeta,U+0392-- >
{"Gamma", "915"}, / / greekcapitallettergamma,U+0393ISOgrk3-- >
{"Delta", "916"}, / / greekcapitalletterdelta,U+0394ISOgrk3-- >
{"Epsilon", "917"}, / / greekcapitalletterepsilon,U+0395-- >
{"Zeta", "918"}, / / greekcapitalletterzeta,U+0396-- >
{"Eta", "919"}, / / greekcapitallettereta,U+0397-- >
{"Theta", "920"}, / / greekcapitallettertheta,U+0398ISOgrk3-- >
{"Iota", "921"}, / / greekcapitalletteriota,U+0399-- >
{"Kappa", "922"}, / / greekcapitalletterkappa,U+039A-- >
{"Lambda", "923"}, / / greekcapitalletterlambda,U+039BISOgrk3-- >
{"Mu", "924"}, / / greekcapitallettermu,U+039C-- >
{"Nu", "925"}, / / greekcapitalletternu,U+039D-- >
{"Xi", "926"}, / / greekcapitalletterxi,U+039EISOgrk3-- >
{"Omicron", "927"}, / / greekcapitalletteromicron,U+039F-- >
{"Pi", "928"}, / / greekcapitalletterpi,U+03A0ISOgrk3-- >
{"Rho", "929"}, / / greekcapitalletterrho,U+03A1-- >
/ /
{"Sigma", "931"}, / / greekcapitallettersigma,U+03A3ISOgrk3-- >
{"Tau", "932"}, / / greekcapitallettertau,U+03A4-- >
{"Upsilon", "933"}, / / greekcapitalletterupsilon,U+03A5ISOgrk3-- >
{"Phi", "934"}, / / greekcapitalletterphi,U+03A6ISOgrk3-- >
{"Chi", "935"}, / / greekcapitalletterchi,U+03A7-- >
{"Psi", "936"}, / / greekcapitalletterpsi,U+03A8ISOgrk3-- >
{"Omega", "937"}, / / greekcapitalletteromega,U+03A9ISOgrk3-- >
{"alpha", "945"}, / / greeksmallletteralpha,U+03B1ISOgrk3-- >
{"beta", "946"}, / / greeksmallletterbeta,U+03B2ISOgrk3-- >
{"gamma", "947"}, / / greeksmalllettergamma,U+03B3ISOgrk3-- >
{"delta", "948"}, / / greeksmallletterdelta,U+03B4ISOgrk3-- >
{"epsilon", "949"}, / / greeksmallletterepsilon,U+03B5ISOgrk3-- >
{"zeta", "950"}, / / greeksmallletterzeta,U+03B6ISOgrk3-- >
{"eta", "951"}, / / greeksmalllettereta,U+03B7ISOgrk3-- >
{"theta", "952"}, / / greeksmalllettertheta,U+03B8ISOgrk3-- >
{"iota", "953"}, / / greeksmallletteriota,U+03B9ISOgrk3-- >
{"kappa", "954"}, / / greeksmallletterkappa,U+03BAISOgrk3-- >
{"lambda", "955"}, / / greeksmallletterlambda,U+03BBISOgrk3-- >
{"mu", "956"}, / / greeksmalllettermu,U+03BCISOgrk3-- >
{"nu", "957"}, / / greeksmallletternu,U+03BDISOgrk3-- >
{"xi", "958"}, / / greeksmallletterxi,U+03BEISOgrk3-- >
{"omicron", "959"}, / / greeksmallletteromicron,U+03BFNEW-- >
{"pi", "960"}, / / greeksmallletterpi,U+03C0ISOgrk3-- >
{"rho", "961"}, / / greeksmallletterrho,U+03C1ISOgrk3-- >
{"sigmaf", "962"}, / / greeksmallletterfinalsigma,U+03C2ISOgrk3-- >
{"sigma", "963"}, / / greeksmalllettersigma,U+03C3ISOgrk3-- >
{"tau", "964"}, / / greeksmalllettertau,U+03C4ISOgrk3-- >
{"upsilon", "965"}, / / greeksmallletterupsilon,U+03C5ISOgrk3-- >
{"phi", "966"}, / / greeksmallletterphi,U+03C6ISOgrk3-- >
{"chi", "967"}, / / greeksmallletterchi,U+03C7ISOgrk3-- >
{"psi", "968"}, / / greeksmallletterpsi,U+03C8ISOgrk3-- >
{"omega", "969"}, / / greeksmallletteromega,U+03C9ISOgrk3-- >
{"thetasym", "977"}, / / greeksmallletterthetasymbol,U+03D1NEW-- >
{"upsih", "978"}, / / greekupsilonwithhooksymbol,U+03D2NEW-- >
{"piv", "982"}, / / greekpisymbol,U+03D6ISOgrk3-- >
/ /
{"bull", "8226"}, / / bullet=blacksmallcircle,U+2022ISOpub-- >
/ /
{"hellip", "8230"}, / / horizontalellipsis=threedotleader,U+2026ISOpub-- >
{"prime", "8242"}, / / prime=minutes=feet,U+2032ISOtech-- >
{"Prime", "8243"}, / / doubleprime=seconds=inches,U+2033ISOtech-- >
{"oline", "8254"}, / / overline=spacingoverscore,U+203ENEW-- >
{"frasl", "8260"}, / / fractionslash,U+2044NEW-- >
/ /
{"weierp", "8472"}, / / scriptcapitalP=powerset=Weierstrassp,U+2118ISOamso-- >
{"image", "8465"}, / / blacklettercapitalI=imaginarypart,U+2111ISOamso-- >
{"real", "8476"}, / / blacklettercapitalR=realpartsymbol,U+211CISOamso-- >
{"trade", "8482"}, / / trademarksign,U+2122ISOnum-- >
{"alefsym", "8501"}, / / alefsymbol=firsttransfinitecardinal,U+2135NEW-- >
/ /
/ /
{"larr", "8592"}, / / leftwardsarrow,U+2190ISOnum-- >
{"uarr", "8593"}, / / upwardsarrow,U+2191ISOnum-- >
{"rarr", "8594"}, / / rightwardsarrow,U+2192ISOnum-- >
{"darr", "8595"}, / / downwardsarrow,U+2193ISOnum-- >
{"harr", "8596"}, / / leftrightarrow,U+2194ISOamsa-- >
{"crarr", "8629"}, / / downwardsarrowwithcornerleftwards=carriagereturn,U+21B5NEW-- >
{"lArr", "8656"}, / / leftwardsdoublearrow,U+21D0ISOtech-- >
/ /
{"uArr", "8657"}, / / upwardsdoublearrow,U+21D1ISOamsa-- >
{"rArr", "8658"}, / / rightwardsdoublearrow,U+21D2ISOtech-- >
/ /
{"dArr", "8659"}, / / downwardsdoublearrow,U+21D3ISOamsa-- >
{"hArr", "8660"}, / / leftrightdoublearrow,U+21D4ISOamsa-- >
/ /
{"forall", "8704"}, / / forall,U+2200ISOtech-- >
{"part", "8706"}, / / partialdifferential,U+2202ISOtech-- >
{"exist", "8707"}, / / thereexists,U+2203ISOtech-- >
{"empty", "8709"}, / / emptyset=nullset=diameter,U+2205ISOamso-- >
{"nabla", "8711"}, / / nabla=backwarddifference,U+2207ISOtech-- >
{"isin", "8712"}, / / elementof,U+2208ISOtech-- >
{"notin", "8713"}, / / notanelementof,U+2209ISOtech-- >
{"ni", "8715"}, / / containsasmember,U+220BISOtech-- >
/ /
{"prod", "8719"}, / / 220FISOamsbyl->
/ /
{"sum", "8721"}, / / copyright 2211 ISOamsb->
/ /
{"minus", "8722"}, / / minussign,U+2212ISOtech-- >
{"lowast", "8727"}, / / asteriskoperator,U+2217ISOtech-- >
{"radic", "8730"}, / / squareroot=radicalsign,U+221AISOtech-- >
{"prop", "8733"}, / / proportionalto,U+221DISOtech-- >
{"infin", "8734"}, / / infinity,U+221EISOtech-- >
{"ang", "8736"}, / / angle,U+2220ISOamso-- >
{"and", "8743"}, / / logicaland=wedge,U+2227ISOtech-- >
{"or", "8744"}, / / logicalor=vee,U+2228ISOtech-- >
{"cap", "8745"}, / / intersection=cap,U+2229ISOtech-- >
{"cup", "8746"}, / / union=cup,U+222AISOtech-- >
{"int", "8747"}, / / integral,U+222BISOtech-- >
{"there4", "8756"}, / / therefore,U+2234ISOtech-- >
{"sim", "8764"}, / / tildeoperator=varieswith=similarto,U+223CISOtech-- >
/ /
{"cong", "8773"}, / / approximatelyequalto,U+2245ISOtech-- >
{"asymp", "8776"}, / / almostequalto=asymptoticto,U+2248ISOamsr-- >
{"ne", "8800"}, / / notequalto,U+2260ISOtech-- >
{"equiv", "8801"}, / / identicalto,U+2261ISOtech-- >
{"le", "8804"}, / / less-thanorequalto,U+2264ISOtech-- >
{"ge", "8805"}, / / greater-thanorequalto,U+2265ISOtech-- >
{"sub", "8834"}, / / subsetof,U+2282ISOtech-- >
{"sup", "8835"}, / / supersetof,U+2283ISOtech-- >
/ /
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.