Accueil





Convertir des entits HTML



Variable dclarer
variable entities { "&agrave;" "" "&agrave;" "" "&aacute;" "" "&acirc;" "" "&atilde;" "" "&auml;" "" "&aring;" "" "&aelig;" "" "&ccedil;" "" "&egrave;" "" "&eacute;" "" "&ecirc;" "" "&euml;" "" "&igrave;" "" "&iacute;" "" "&icirc;" "" "&iuml;" "" "&eth;" "" "&ntilde;" "" "&ograve;" "" "&oacute;" "" "&ocirc;" "" "&otilde;" "" "&ouml;" "" "&divide;" "" "&oslash;" "" "&ugrave;" "" "&uacute;" "" "&ucirc;" "" "&uuml;" "" "&yacute;" "" "&thorn;" "" "&yuml;" "" "&quot;" "\"" "&amp;" "&" "&euro;" "" "&oelig;" "" "&Yuml;" "" "&nbsp;" " " "&iexcl;" "" "&cent;" "" "&pound;" "" "&curren;" "" "&yen;" "" "&brvbar;" "" "&brkbar;" "" "&sect;" "" "&uml;" "" "&die;" "" "&copy;" "" "&ordf;" "" "&laquo;" "" "&not;" "" "&shy;" "-" "&reg;" "" "&macr;" "" "&hibar;" "" "&deg;" "" "&plusmn;" "" "&sup2;" "" "&sup3;" "" "&acute;" "" "&micro;" "" "&para;" "" "&middot;" "" "&cedil;" "" "&sup1;" "" "&ordm;" "" "&raquo;" "" "&frac14;" "" "&frac12;" "" "&frac34;" "" "&iquest;" "" "&Agrave;" "" "&Aacute;" "" "&Acirc;" "" "&Atilde;" "" "&Auml;" "" "&Aring;" "" "&AElig;" "" "&Ccedil;" "" "&Egrave;" "" "&Eacute;" "" "&Ecirc;" "" "&Euml;" "" "&Igrave;" "" "&Iacute;" "" "&Icirc;" "" "&Iuml;" "" "&ETH;" "" "&Dstrok;" "" "&Ntilde;" "" "&Ograve;" "" "&Oacute;" "" "&Ocirc;" "" "&Otilde;" "" "&Ouml;" "" "&times;" "" "&Oslash;" "" "&Ugrave;" "" "&Uacute;" "" "&Ucirc;" "" "&Uuml;" "" "&Yacute;" "" "&THORN;" "" "&szlig;" "" "\r" "\n" "\t" "" "&apos;" "\'" "&#039;" "\'" "&#39;" "\'" "&#92" "\\" "&#34;" "\"" "&#38;" "&" "&#091;" "\[" "&#047;" "/" "&lt;" "<" "&gt;" ">" "&#093;" "\]" "&#47;" "/" "&#040;" "\(" "&#041;" "\)" "&#163;" "" "&#33;" "!" "&#168;" "" "&#169;" "" "&#171;" "" "&#173;" "" "&#174;" "" "&#180;" "" "&#183;" "" "&#185;" "" "&#187;" "" "&#188;" "" "&#189;" "" "&#190;" "" "&#192;" "" "&#193;" "" "&#194;" "" "&#195;" "" "&#196;" "" "&#197;" "" "&#198;" "" "&#199;" "" "&#200;" "" "&#201;" "" "&#202;" "" "&#203;" "" "&#204;" "" "&#205;" "" "&#206;" "" "&#207;" "" "&#208;" "" "&#209;" "" "&#210;" "" "&#211;" "" "&#212;" "" "&#213;" "" "&#214;" "" "&#215;" "" "&#216;" "" "&#217;" "" "&#218;" "" "&#219;" "" "&#220;" "" "&#221;" "" "&#222;" "" "&#223;" "" "&#224;" "" "&#225;" "" "&#226;" "" "&#227;" "" "&#228;" "" "&#229;" "" "&#230;" "" "&#231;" "" "&#232;" "" "&#233;" "" "&#234;" "" "&#235;" "" "&#236;" "" "&#237;" "" "&#238;" "" "&#239;" "" "&#240;" "" "&#241;" "" "&#242;" "" "&#243;" "" "&#244;" "" "&#245;" "" "&#246;" "" "&#247;" "" "&#248;" "" "&#249;" "" "&#250;" "" "&#251;" "" "&#252;" "" "&#253;" "" "&#254;" "" }


Procdure
proc html_entities_decode {data} { variable entities return [::tcl::string::map $entities $data] } proc html_entities_encode {data} { variable entities return [::tcl::string::map [lreverse $entities] $data] }


La procdure suivante convertira automatiquement toutes les entits html dcimales ou hexadcimales ( formats &#?? ou &#x??; ).
proc html_hexdec_decode {data} { regsub -all {&#([[:digit:]]{1,5});} $data {[format %c [string trimleft "\1" "0"]]} data regsub -all {&#x([[:xdigit:]]{1,4});} $data {[format %c [scan "\1" %x]]} data return [subst $data] }

2005-2016 Menz Agitat