/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import flash.text.TextField; var myStr:String = "&%20<%20>%20"%20'%20£%20©%20%AE"; function htmlUnescape($str:String):String { var tf:TextField = new TextField(); tf.htmlText = unescape($str); return tf.text; } trace(myStr); trace(htmlUnescape(myStr)); // OUTPUT // &%20<%20>%20"%20'%20£%20©%20%AE // & < > " ' £ © ® // This doesn't work for a lot of the other HTML Entity Names. // For example, £ and © don't work. // See here for a list of HTML Entity Names ... // http://www.adrianparr.com/download/Special%20Characters%20Cheat%20Sheet.pdf // // For a full working class that supports ALL HTML Entity Names see here ... // http://snipplr.com/view/46566/as3-encode-and-decode-html-entity-names-full-set/