Function overview
Prototype
HTMLencoded2Text (
_text )
Parameters
_text
Description
Tags:
Text HTML Encoding
Translates HTML encoded text into standard text
Examples
Sample input
HTMLencoded2Text ( "Smith&Wesson" )
or
HTMLencoded2Text ( "Smith&Wesson" )
Sample output
Smith&Wesson
Function code
/* HTMLencoded2Text ( _text )
by Fabrice Nordmann
http://www.1-more-thing.com - Twitter: @1morethingtweet
v.2.0 - Sept 2016
- supports hexadecimal entities (® -> ®)
v.1.4.1 - Sep 2011
- fixed bug causing Substitute to be skipped when using this function multiple times in the same script context (HOnza)
v.1.4 - Sep 2011
- optimized to run much faster thanks to FM Bench Detective (http://fmbench.com/detective) (HOnza)
v.1.3 - Aug 2011
- updated list of named character entities from http://alumnus.caltech.edu/~leif/namedchar.html (HOnza)
v.1.2 - Mar 2009
- handles long unicodes (Clément Hoffmann)
v.1.1.1 - Jan 2009
- added more HTML entities
v.1.1 - Jan 2009
- added the HTML entities
v.1.0 - Jan 2009
Translates HTML encoded text into standard text
example :
HTMLencoded2Text ( "Smith&Wesson" ) = "Smith&Wesson"
Requires FileMaker 10 or later
Recursive function
*/
Case ( $cf.mode = "Hex2Num" ;
//for the sake of ease of implementation, the Hex2Num function is included.
Case ( IsEmpty ( _text ) ; Let ([ _result = $cf.hex.result; $cf.hex.result = "" ; $cf.hex.depth = "" ; $cf.mode = "" ]; _result ) ;
Let ([
_alpha = "0123456789ABCDEF" ;
_hex = Case ( $cf.hex.depth ; _text ; Filter ( Upper ( _text ) ; _alpha )) ;
$$debug.hex = List ( $$debug.hex ; _hex ) ;
$cf.hex.result = $cf.hex.result + ( Position ( _alpha ; Right ( _text ; 1 ) ; 0 ; 1 ) - 1 )* 16^(0+$cf.hex.depth) ;
$cf.hex.depth = $cf.hex.depth + 1
];
HTMLencoded2Text ( Left ( _hex ; Length ( _hex ) - 1 )) )
) ;
Let ( [ _text = Case( $HTMLencoded2Text_deep; _text; Substitute ( _text ;
[" "; " "] ;
["¡"; "¡"] ;
["¢"; "¢"] ;
["£"; "£"] ;
["¤"; "¤"] ;
["¥"; "¥"] ;
["¦"; "¦"] ;
["§"; "§"] ;
["¨"; "¨"] ;
["©"; "©"] ;
["ª"; "ª"] ;
["«"; "«"] ;
["¬"; "¬"] ;
["­"; " "] ;
["®"; "®"] ;
["¯"; "¯"] ;
["°"; "°"] ;
["±"; "±"] ;
["²"; "²"] ;
["³"; "³"] ;
["´"; "´"] ;
["µ"; "µ"] ;
["¶"; "\¶"] ;
["·"; "·"] ;
["¸"; "¸"] ;
["¹"; "¹"] ;
["º"; "º"] ;
["»"; "»"] ;
["¼"; "¼"] ;
["½"; "½"] ;
["¾"; "¾"] ;
["¿"; "¿"] ;
["À"; "À"] ;
["Á"; "Á"] ;
["Â"; "Â"] ;
["Ã"; "Ã"] ;
["Ä"; "Ä"] ;
["Å"; "Å"] ;
["Æ"; "Æ"] ;
["Ç"; "Ç"] ;
["È"; "È"] ;
["É"; "É"] ;
["Ê"; "Ê"] ;
["Ë"; "Ë"] ;
["Ì"; "Ì"] ;
["Í"; "Í"] ;
["Î"; "Î"] ;
["Ï"; "Ï"] ;
["Ð"; "Ð"] ;
["Ñ"; "Ñ"] ;
["Ò"; "Ò"] ;
["Ó"; "Ó"] ;
["Ô"; "Ô"] ;
["Õ"; "Õ"] ;
["Ö"; "Ö"] ;
["×"; "×"] ;
["Ø"; "Ø"] ;
["Ù"; "Ù"] ;
["Ú"; "Ú"] ;
["Û"; "Û"] ;
["Ü"; "Ü"] ;
["Ý"; "Ý"] ;
["Þ"; "Þ"] ;
["ß"; "ß"] ;
["à"; "à"] ;
["á"; "á"] ;
["â"; "â"] ;
["ã"; "ã"] ;
["ä"; "ä"] ;
["å"; "å"] ;
["æ"; "æ"] ;
["ç"; "ç"] ;
["è"; "è"] ;
["é"; "é"] ;
["ê"; "ê"] ;
["ë"; "ë"] ;
["ì"; "ì"] ;
["í"; "í"] ;
["î"; "î"] ;
["ï"; "ï"] ;
["ð"; "ð"] ;
["ñ"; "ñ"] ;
["ò"; "ò"] ;
["ó"; "ó"] ;
["ô"; "ô"] ;
["õ"; "õ"] ;
["ö"; "ö"] ;
["÷"; "÷"] ;
["ø"; "ø"] ;
["ù"; "ù"] ;
["ú"; "ú"] ;
["û"; "û"] ;
["ü"; "ü"] ;
["ý"; "ý"] ;
["þ"; "þ"] ;
["ÿ"; "ÿ"] ;
["ƒ"; "ƒ"] ;
["Α"; "Α"] ;
["Β"; "Β"] ;
["Γ"; "Γ"] ;
["Δ"; "Δ"] ;
["Ε"; "Ε"] ;
["Ζ"; "Ζ"] ;
["Η"; "Η"] ;
["Θ"; "Θ"] ;
["Ι"; "Ι"] ;
["Κ"; "Κ"] ;
["Λ"; "Λ"] ;
["Μ"; "Μ"] ;
["Ν"; "Ν"] ;
["Ξ"; "Ξ"] ;
["Ο"; "Ο"] ;
["Π"; "Π"] ;
["Ρ"; "Ρ"] ;
["Σ"; "Σ"] ;
["Τ"; "Τ"] ;
["Υ"; "Υ"] ;
["Φ"; "Φ"] ;
["Χ"; "Χ"] ;
["Ψ"; "Ψ"] ;
["Ω"; "Ω"] ;
["α"; "α"] ;
["β"; "β"] ;
["γ"; "γ"] ;
["δ"; "δ"] ;
["ε"; "ε"] ;
["ζ"; "ζ"] ;
["η"; "η"] ;
["θ"; "θ"] ;
["ι"; "ι"] ;
["κ"; "κ"] ;
["λ"; "λ"] ;
["μ"; "μ"] ;
["ν"; "ν"] ;
["ξ"; "ξ"] ;
["ο"; "ο"] ;
["π"; "π"] ;
["ρ"; "ρ"] ;
["ς"; "ς"] ;
["σ"; "σ"] ;
["τ"; "τ"] ;
["υ"; "υ"] ;
["φ"; "φ"] ;
["χ"; "χ"] ;
["ψ"; "ψ"] ;
["ω"; "ω"] ;
["ϑ"; "ϑ"] ;
["ϒ"; "ϒ"] ;
["ϖ"; "ϖ"] ;
["•"; "•"] ;
["…"; "…"] ;
["′"; "′"] ;
["″"; "″"] ;
["‾"; "‾"] ;
["⁄"; "⁄"] ;
["℘"; "℘"] ;
["ℑ"; "ℑ"] ;
["ℜ"; "ℜ"] ;
["™"; "™"] ;
["ℵ"; "ℵ"] ;
["←"; "←"] ;
["↑"; "↑"] ;
["→"; "→"] ;
["↓"; "↓"] ;
["↔"; "↔"] ;
["↵"; "↵"] ;
["⇐"; "⇐"] ;
["⇑"; "⇑"] ;
["⇒"; "⇒"] ;
["⇓"; "⇓"] ;
["⇔"; "⇔"] ;
["∀"; "∀"] ;
["∂"; "∂"] ;
["∃"; "∃"] ;
["∅"; "∅"] ;
["∇"; "∇"] ;
["∈"; "∈"] ;
["∉"; "∉"] ;
["∋"; "∋"] ;
["∏"; "∏"] ;
["∑"; "∑"] ;
["−"; "−"] ;
["∗"; "∗"] ;
["√"; "√"] ;
["∝"; "∝"] ;
["∞"; "∞"] ;
["∠"; "∠"] ;
["∧"; "∧"] ;
["∨"; "∨"] ;
["∩"; "∩"] ;
["∪"; "∪"] ;
["∫"; "∫"] ;
["∴"; "∴"] ;
["∼"; "∼"] ;
["≅"; "≅"] ;
["≈"; "≈"] ;
["≠"; "≠"] ;
["≡"; "≡"] ;
["≤"; "≤"] ;
["≥"; "≥"] ;
["⊂"; "⊂"] ;
["⊃"; "⊃"] ;
["⊆"; "⊆"] ;
["⊇"; "⊇"] ;
["⊕"; "⊕"] ;
["⊗"; "⊗"] ;
["⊥"; "⊥"] ;
["⋅"; "⋅"] ;
["⌈"; "⌈"] ;
["⌉"; "⌉"] ;
["⌊"; "⌊"] ;
["⌋"; "⌋"] ;
["⟨"; "⟨"] ;
["⟩"; "⟩"] ;
["◊"; "◊"] ;
["♠"; "♠"] ;
["♣"; "♣"] ;
["♥"; "♥"] ;
["♦"; "♦"] ;
["""; "\""] ;
["&"; "&"] ;
["<"; "<"] ;
[">"; ">"] ;
["Œ"; "Œ"] ;
["œ"; "œ"] ;
["Š"; "Š"] ;
["š"; "š"] ;
["Ÿ"; "Ÿ"] ;
["ˆ"; "ˆ"] ;
["˜"; "˜"] ;
[" "; " "] ;
[" "; " "] ;
[" "; " "] ;
["‌"; " "] ;
["‍"; " "] ;
["‎"; " "] ;
["‏"; " "] ;
["–"; "–"] ;
["—"; "—"] ;
["‘"; ""] ;
["’"; ""] ;
["‚"; "‚"] ;
["“"; "\“"] ;
["”"; "\”"] ;
["„"; "\„"] ;
["†"; "†"] ;
["‡"; "‡"] ;
["‰"; "‰"] ;
["‹"; "‹"] ;
["›"; "›"] ;
["€"; "€"]
)) ;
$HTMLencoded2Text_depth = $HTMLencoded2Text_depth + 1 ;
_finalresult = Case ( not Position ( _text ; "&#"; 1; 1 ) ; _text ;
Let ([
_pos = Position ( _text ; "&#" ; 1 ; 1 ) ;
_pos2 = Position ( _text ; ";" ; _pos ; 1 ) - _pos ;
_word = Middle ( _text ; _pos ; _pos2 + 1 ) ;
_isCode = Length ( _word ) >= 4 and Length ( _word ) <= 8 and Substitute ( _word ; [ 0 ; "" ] ; [ 1 ; "" ] ; [ 2 ; "" ] ; [ 3 ; "" ] ; [ 4 ; "" ] ; [ 5 ; "" ] ; [ 6 ; "" ] ; [ 7 ; "" ] ; [ 8 ; "" ] ; [ 9 ; "" ]) = "&#;" ;
_isHex = not _isCode and Left ( _word ; 3) = "&#x" and Right ( _word ; 1 ) = ";" ;
// If you're a purist or need more iterations, copy the Hex2Num part of this function (at the top) as a new function, uncomment this line and comment out the next one.
// _result = Debut ( _text ; _pos - 1 ) & Cas ( _isCode ; Caractere ( ObtenirNombre ( _word )) ; _isHex ; Caractere ( Hex2Num ( Extrait ( _word ; 3 ; Longueur ( _word ) - 3 ))) ; "&" ) ;
_result = Left ( _text ; _pos - 1 ) & Case ( _isCode ; Char ( GetAsNumber ( _word )) ; _isHex ; Let ( $cf.mode = "Hex2Num" ; Char ( GetAsNumber ( HTMLencoded2Text ( Middle ( _word ; 3 ; Length ( _word ) - 3 ))))) ; "&" ) ;
$debug = List ( $debug ; _result )
];
_result & HTMLencoded2Text ( Right ( _text ; Length ( _text ) - ( _pos + Case ( _isCode ; Length ( _word ) - 1 ; _isHex ; Length ( _word ) - 1 ))))
));
$HTMLencoded2Text_depth = $HTMLencoded2Text_depth - 1
];
_finalresult
)
)
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/178
Prototype: HTMLencoded2Text( _text )
Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
Last updated: 13 September 2016
Version: 4.0
*/
// ===================================
/* HTMLencoded2Text ( _text )__LITBR____LITBR__by Fabrice Nordmann__LITBR__http://www.1-more-thing.com - Twitter: @1morethingtweet__LITBR____LITBR____LITBR__v.2.0 - Sept 2016__LITBR__ - supports hexadecimal entities (® -> ®)__LITBR__v.1.4.1 - Sep 2011__LITBR__ - fixed bug causing Substitute to be skipped when using this function multiple times in the same script context (HOnza)__LITBR__v.1.4 - Sep 2011__LITBR__ - optimized to run much faster thanks to FM Bench Detective (http://fmbench.com/detective) (HOnza)__LITBR__v.1.3 - Aug 2011__LITBR__ - updated list of named character entities from http://alumnus.caltech.edu/~leif/namedchar.html (HOnza)__LITBR__v.1.2 - Mar 2009__LITBR__ - handles long unicodes (Clément Hoffmann)__LITBR__v.1.1.1 - Jan 2009__LITBR__ - added more HTML entities__LITBR__v.1.1 - Jan 2009__LITBR__ - added the HTML entities__LITBR__v.1.0 - Jan 2009__LITBR____LITBR____LITBR__Translates HTML encoded text into standard text__LITBR____LITBR__example :__LITBR__HTMLencoded2Text ( "Smith&Wesson" ) = "Smith&Wesson"__LITBR____LITBR____LITBR__Requires FileMaker 10 or later__LITBR____LITBR__Recursive function__LITBR__*/__LITBR____LITBR____LITBR____LITBR__Case ( $cf.mode = "Hex2Num" ;__LITBR__ //for the sake of ease of implementation, the Hex2Num function is included.__LITBR__ Case ( IsEmpty ( _text ) ; Let ([ _result = $cf.hex.result; $cf.hex.result = "" ; $cf.hex.depth = "" ; $cf.mode = "" ]; _result ) ;__LITBR____LITBR__ Let ([__LITBR__ _alpha = "0123456789ABCDEF" ;__LITBR__ _hex = Case ( $cf.hex.depth ; _text ; Filter ( Upper ( _text ) ; _alpha )) ;__LITBR__ $$debug.hex = List ( $$debug.hex ; _hex ) ;__LITBR__ $cf.hex.result = $cf.hex.result + ( Position ( _alpha ; Right ( _text ; 1 ) ; 0 ; 1 ) - 1 )* 16^(0+$cf.hex.depth) ;__LITBR__ $cf.hex.depth = $cf.hex.depth + 1__LITBR__ ];__LITBR__ HTMLencoded2Text ( Left ( _hex ; Length ( _hex ) - 1 )) )__LITBR__) ;__LITBR____LITBR____LITBR____LITBR____LITBR__Let ( [ _text = Case( $HTMLencoded2Text_deep; _text; Substitute ( _text ;__LITBR__ [" "; " "] ;__LITBR__ ["¡"; "¡"] ;__LITBR__ ["¢"; "¢"] ;__LITBR__ ["£"; "£"] ;__LITBR__ ["¤"; "¤"] ;__LITBR__ ["¥"; "¥"] ;__LITBR__ ["¦"; "¦"] ;__LITBR__ ["§"; "§"] ;__LITBR__ ["¨"; "¨"] ;__LITBR__ ["©"; "©"] ;__LITBR__ ["ª"; "ª"] ;__LITBR__ ["«"; "«"] ;__LITBR__ ["¬"; "¬"] ;__LITBR__ ["­"; " "] ;__LITBR__ ["®"; "®"] ;__LITBR__ ["¯"; "¯"] ;__LITBR__ ["°"; "°"] ;__LITBR__ ["±"; "±"] ;__LITBR__ ["²"; "²"] ;__LITBR__ ["³"; "³"] ;__LITBR__ ["´"; "´"] ;__LITBR__ ["µ"; "µ"] ;__LITBR__ ["¶"; "\¶"] ;__LITBR__ ["·"; "·"] ;__LITBR__ ["¸"; "¸"] ;__LITBR__ ["¹"; "¹"] ;__LITBR__ ["º"; "º"] ;__LITBR__ ["»"; "»"] ;__LITBR__ ["¼"; "¼"] ;__LITBR__ ["½"; "½"] ;__LITBR__ ["¾"; "¾"] ;__LITBR__ ["¿"; "¿"] ;__LITBR__ ["À"; "À"] ;__LITBR__ ["Á"; "Á"] ;__LITBR__ ["Â"; "Â"] ;__LITBR__ ["Ã"; "Ã"] ;__LITBR__ ["Ä"; "Ä"] ;__LITBR__ ["Å"; "Å"] ;__LITBR__ ["Æ"; "Æ"] ;__LITBR__ ["Ç"; "Ç"] ;__LITBR__ ["È"; "È"] ;__LITBR__ ["É"; "É"] ;__LITBR__ ["Ê"; "Ê"] ;__LITBR__ ["Ë"; "Ë"] ;__LITBR__ ["Ì"; "Ì"] ;__LITBR__ ["Í"; "Í"] ;__LITBR__ ["Î"; "Î"] ;__LITBR__ ["Ï"; "Ï"] ;__LITBR__ ["Ð"; "Ð"] ;__LITBR__ ["Ñ"; "Ñ"] ;__LITBR__ ["Ò"; "Ò"] ;__LITBR__ ["Ó"; "Ó"] ;__LITBR__ ["Ô"; "Ô"] ;__LITBR__ ["Õ"; "Õ"] ;__LITBR__ ["Ö"; "Ö"] ;__LITBR__ ["×"; "×"] ;__LITBR__ ["Ø"; "Ø"] ;__LITBR__ ["Ù"; "Ù"] ;__LITBR__ ["Ú"; "Ú"] ;__LITBR__ ["Û"; "Û"] ;__LITBR__ ["Ü"; "Ü"] ;__LITBR__ ["Ý"; "Ý"] ;__LITBR__ ["Þ"; "Þ"] ;__LITBR__ ["ß"; "ß"] ;__LITBR__ ["à"; "à"] ;__LITBR__ ["á"; "á"] ;__LITBR__ ["â"; "â"] ;__LITBR__ ["ã"; "ã"] ;__LITBR__ ["ä"; "ä"] ;__LITBR__ ["å"; "å"] ;__LITBR__ ["æ"; "æ"] ;__LITBR__ ["ç"; "ç"] ;__LITBR__ ["è"; "è"] ;__LITBR__ ["é"; "é"] ;__LITBR__ ["ê"; "ê"] ;__LITBR__ ["ë"; "ë"] ;__LITBR__ ["ì"; "ì"] ;__LITBR__ ["í"; "í"] ;__LITBR__ ["î"; "î"] ;__LITBR__ ["ï"; "ï"] ;__LITBR__ ["ð"; "ð"] ;__LITBR__ ["ñ"; "ñ"] ;__LITBR__ ["ò"; "ò"] ;__LITBR__ ["ó"; "ó"] ;__LITBR__ ["ô"; "ô"] ;__LITBR__ ["õ"; "õ"] ;__LITBR__ ["ö"; "ö"] ;__LITBR__ ["÷"; "÷"] ;__LITBR__ ["ø"; "ø"] ;__LITBR__ ["ù"; "ù"] ;__LITBR__ ["ú"; "ú"] ;__LITBR__ ["û"; "û"] ;__LITBR__ ["ü"; "ü"] ;__LITBR__ ["ý"; "ý"] ;__LITBR__ ["þ"; "þ"] ;__LITBR__ ["ÿ"; "ÿ"] ;__LITBR__ ["ƒ"; "ƒ"] ;__LITBR__ ["Α"; "Α"] ;__LITBR__ ["Β"; "Β"] ;__LITBR__ ["Γ"; "Γ"] ;__LITBR__ ["Δ"; "Δ"] ;__LITBR__ ["Ε"; "Ε"] ;__LITBR__ ["Ζ"; "Ζ"] ;__LITBR__ ["Η"; "Η"] ;__LITBR__ ["Θ"; "Θ"] ;__LITBR__ ["Ι"; "Ι"] ;__LITBR__ ["Κ"; "Κ"] ;__LITBR__ ["Λ"; "Λ"] ;__LITBR__ ["Μ"; "Μ"] ;__LITBR__ ["Ν"; "Ν"] ;__LITBR__ ["Ξ"; "Ξ"] ;__LITBR__ ["Ο"; "Ο"] ;__LITBR__ ["Π"; "Π"] ;__LITBR__ ["Ρ"; "Ρ"] ;__LITBR__ ["Σ"; "Σ"] ;__LITBR__ ["Τ"; "Τ"] ;__LITBR__ ["Υ"; "Υ"] ;__LITBR__ ["Φ"; "Φ"] ;__LITBR__ ["Χ"; "Χ"] ;__LITBR__ ["Ψ"; "Ψ"] ;__LITBR__ ["Ω"; "Ω"] ;__LITBR__ ["α"; "α"] ;__LITBR__ ["β"; "β"] ;__LITBR__ ["γ"; "γ"] ;__LITBR__ ["δ"; "δ"] ;__LITBR__ ["ε"; "ε"] ;__LITBR__ ["ζ"; "ζ"] ;__LITBR__ ["η"; "η"] ;__LITBR__ ["θ"; "θ"] ;__LITBR__ ["ι"; "ι"] ;__LITBR__ ["κ"; "κ"] ;__LITBR__ ["λ"; "λ"] ;__LITBR__ ["μ"; "μ"] ;__LITBR__ ["ν"; "ν"] ;__LITBR__ ["ξ"; "ξ"] ;__LITBR__ ["ο"; "ο"] ;__LITBR__ ["π"; "π"] ;__LITBR__ ["ρ"; "ρ"] ;__LITBR__ ["ς"; "ς"] ;__LITBR__ ["σ"; "σ"] ;__LITBR__ ["τ"; "τ"] ;__LITBR__ ["υ"; "υ"] ;__LITBR__ ["φ"; "φ"] ;__LITBR__ ["χ"; "χ"] ;__LITBR__ ["ψ"; "ψ"] ;__LITBR__ ["ω"; "ω"] ;__LITBR__ ["ϑ"; "ϑ"] ;__LITBR__ ["ϒ"; "ϒ"] ;__LITBR__ ["ϖ"; "ϖ"] ;__LITBR__ ["•"; "•"] ;__LITBR__ ["…"; "…"] ;__LITBR__ ["′"; "′"] ;__LITBR__ ["″"; "″"] ;__LITBR__ ["‾"; "‾"] ;__LITBR__ ["⁄"; "⁄"] ;__LITBR__ ["℘"; "℘"] ;__LITBR__ ["ℑ"; "ℑ"] ;__LITBR__ ["ℜ"; "ℜ"] ;__LITBR__ ["™"; "™"] ;__LITBR__ ["ℵ"; "ℵ"] ;__LITBR__ ["←"; "←"] ;__LITBR__ ["↑"; "↑"] ;__LITBR__ ["→"; "→"] ;__LITBR__ ["↓"; "↓"] ;__LITBR__ ["↔"; "↔"] ;__LITBR__ ["↵"; "↵"] ;__LITBR__ ["⇐"; "⇐"] ;__LITBR__ ["⇑"; "⇑"] ;__LITBR__ ["⇒"; "⇒"] ;__LITBR__ ["⇓"; "⇓"] ;__LITBR__ ["⇔"; "⇔"] ;__LITBR__ ["∀"; "∀"] ;__LITBR__ ["∂"; "∂"] ;__LITBR__ ["∃"; "∃"] ;__LITBR__ ["∅"; "∅"] ;__LITBR__ ["∇"; "∇"] ;__LITBR__ ["∈"; "∈"] ;__LITBR__ ["∉"; "∉"] ;__LITBR__ ["∋"; "∋"] ;__LITBR__ ["∏"; "∏"] ;__LITBR__ ["∑"; "∑"] ;__LITBR__ ["−"; "−"] ;__LITBR__ ["∗"; "∗"] ;__LITBR__ ["√"; "√"] ;__LITBR__ ["∝"; "∝"] ;__LITBR__ ["∞"; "∞"] ;__LITBR__ ["∠"; "∠"] ;__LITBR__ ["∧"; "∧"] ;__LITBR__ ["∨"; "∨"] ;__LITBR__ ["∩"; "∩"] ;__LITBR__ ["∪"; "∪"] ;__LITBR__ ["∫"; "∫"] ;__LITBR__ ["∴"; "∴"] ;__LITBR__ ["∼"; "∼"] ;__LITBR__ ["≅"; "≅"] ;__LITBR__ ["≈"; "≈"] ;__LITBR__ ["≠"; "≠"] ;__LITBR__ ["≡"; "≡"] ;__LITBR__ ["≤"; "≤"] ;__LITBR__ ["≥"; "≥"] ;__LITBR__ ["⊂"; "⊂"] ;__LITBR__ ["⊃"; "⊃"] ;__LITBR__ ["⊆"; "⊆"] ;__LITBR__ ["⊇"; "⊇"] ;__LITBR__ ["⊕"; "⊕"] ;__LITBR__ ["⊗"; "⊗"] ;__LITBR__ ["⊥"; "⊥"] ;__LITBR__ ["⋅"; "⋅"] ;__LITBR__ ["⌈"; "⌈"] ;__LITBR__ ["⌉"; "⌉"] ;__LITBR__ ["⌊"; "⌊"] ;__LITBR__ ["⌋"; "⌋"] ;__LITBR__ ["⟨"; "⟨"] ;__LITBR__ ["⟩"; "⟩"] ;__LITBR__ ["◊"; "◊"] ;__LITBR__ ["♠"; "♠"] ;__LITBR__ ["♣"; "♣"] ;__LITBR__ ["♥"; "♥"] ;__LITBR__ ["♦"; "♦"] ;__LITBR__ ["""; "\""] ;__LITBR__ ["&"; "&"] ;__LITBR__ ["<"; "<"] ;__LITBR__ [">"; ">"] ;__LITBR__ ["Œ"; "Œ"] ;__LITBR__ ["œ"; "œ"] ;__LITBR__ ["Š"; "Š"] ;__LITBR__ ["š"; "š"] ;__LITBR__ ["Ÿ"; "Ÿ"] ;__LITBR__ ["ˆ"; "ˆ"] ;__LITBR__ ["˜"; "˜"] ;__LITBR__ [" "; " "] ;__LITBR__ [" "; " "] ;__LITBR__ [" "; " "] ;__LITBR__ ["‌"; " "] ;__LITBR__ ["‍"; " "] ;__LITBR__ ["‎"; " "] ;__LITBR__ ["‏"; " "] ;__LITBR__ ["–"; "–"] ;__LITBR__ ["—"; "—"] ;__LITBR__ ["‘"; ""] ;__LITBR__ ["’"; ""] ;__LITBR__ ["‚"; "‚"] ;__LITBR__ ["“"; "\“"] ;__LITBR__ ["”"; "\”"] ;__LITBR__ ["„"; "\„"] ;__LITBR__ ["†"; "†"] ;__LITBR__ ["‡"; "‡"] ;__LITBR__ ["‰"; "‰"] ;__LITBR__ ["‹"; "‹"] ;__LITBR__ ["›"; "›"] ;__LITBR__ ["€"; "€"]__LITBR__)) ;__LITBR__$HTMLencoded2Text_depth = $HTMLencoded2Text_depth + 1 ;__LITBR___finalresult = Case ( not Position ( _text ; "&#"; 1; 1 ) ; _text ;__LITBR__ Let ([ __LITBR__ _pos = Position ( _text ; "&#" ; 1 ; 1 ) ;__LITBR__ _pos2 = Position ( _text ; ";" ; _pos ; 1 ) - _pos ;__LITBR__ _word = Middle ( _text ; _pos ; _pos2 + 1 ) ;__LITBR__ _isCode = Length ( _word ) >= 4 and Length ( _word ) <= 8 and Substitute ( _word ; [ 0 ; "" ] ; [ 1 ; "" ] ; [ 2 ; "" ] ; [ 3 ; "" ] ; [ 4 ; "" ] ; [ 5 ; "" ] ; [ 6 ; "" ] ; [ 7 ; "" ] ; [ 8 ; "" ] ; [ 9 ; "" ]) = "&#;" ;__LITBR__ _isHex = not _isCode and Left ( _word ; 3) = "&#x" and Right ( _word ; 1 ) = ";" ;__LITBR__// If you're a purist or need more iterations, copy the Hex2Num part of this function (at the top) as a new function, uncomment this line and comment out the next one. __LITBR__// _result = Debut ( _text ; _pos - 1 ) & Cas ( _isCode ; Caractere ( ObtenirNombre ( _word )) ; _isHex ; Caractere ( Hex2Num ( Extrait ( _word ; 3 ; Longueur ( _word ) - 3 ))) ; "&" ) ;__LITBR__ _result = Left ( _text ; _pos - 1 ) & Case ( _isCode ; Char ( GetAsNumber ( _word )) ; _isHex ; Let ( $cf.mode = "Hex2Num" ; Char ( GetAsNumber ( HTMLencoded2Text ( Middle ( _word ; 3 ; Length ( _word ) - 3 ))))) ; "&" ) ;__LITBR__ $debug = List ( $debug ; _result )__LITBR__ ];__LITBR__ _result & HTMLencoded2Text ( Right ( _text ; Length ( _text ) - ( _pos + Case ( _isCode ; Length ( _word ) - 1 ; _isHex ; Length ( _word ) - 1 ))))__LITBR__ ));__LITBR__ $HTMLencoded2Text_depth = $HTMLencoded2Text_depth - 1__LITBR__];__LITBR__ _finalresult__LITBR__)__LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/178__LITBR____LITBR__ Prototype: HTMLencoded2Text( _text )__LITBR__ Function Author: Fabrice (http://www.fmfunctions.com/mid/37)__LITBR__ Last updated: 13 September 2016__LITBR__ Version: 4.0__LITBR____LITBR__*/__LITBR__// ===================================
Comments
04 May 2009
During an import, I found myself with those here who was not in your list
; [ "≤" ; "≤" ]
; [ "≥ " ; "≥" ]
; [ "¶" ; Citation ( "#|^|#¶#|^|#" ) ]
; [ "\"#|^|#" ; "" ]; [ "#|^|#\"" ; "" ]
; [ "“" ; "\"" ]
; [ "”" ; "\"" ]
in cazou
Thanks a lots for this one !
Agnès
(Edited by Agnès on 04/05/09 )
29 August 2011
Feel free to download it here: http://24usw.com/hent
(Edited by HOnza on 29/08/11 )
29 August 2011
14 September 2011
Re-download my sample file from http://24usw.com/hent to get the updated custom function.
I am also going to post a video of the optimization as soon as I get some time to cut it…
14 September 2011
I have made a mistake in the optimization, causing the function to not work right when used multiple times in the same context (the $HTMLencoded2Text_deep variable was persisting across multiple calls). If you have already downloaded the optimized version, please re-download the file with this bug fixed.
Correction: it's about 8 times faster on the 33KB text and maybe not millions but only several hundreds times faster on the 1.4MB text ;-)
(Edited by HOnza on 14/09/11 )
27 January 2012
07 July 2014
07 July 2014
http://www.w3schools.com/tags/ref_urlencode.asp
10 September 2016
[" "; " "];
["’"; "'"];
["“"; "\""];
["”"; "\""];
["–"; "-"];
["—"; "—"];
["•"; "•"];
["‘"; "'"];
["®"; "®"];
["©"; "©"];
["é"; "é"];
["™"; "™"];
["ç"; "ç"];
["à"; "à"];
["è"; "è"];
["…"; "…"]
13 September 2016
Here you are. Now all hexadecimal entities are supported.