Encode HTML in Flex/Actionscript
Are there any functions available to convert:
Me, Myself & I
to
Me, Myself & I开发者_如何转开发
I can't find anything in the Flex documentation.
Thanks.
Check this out. No swc's to include. Basically it's
var s:String = new XMLNode(3, "Me, Myself & I").toString();
Here's the AS3 solution:
import flash.xml.XMLNode;
import flash.xml.XMLNodeType;
public function htmlEscape(str:String):String {
return XML( new XMLNode( XMLNodeType.TEXT_NODE, str ) ).toXMLString();
}
Source: http://www.razorberry.com/blog/archives/2007/11/02/converting-html-entities-in-as3/
Escape should do it:
http://livedocs.adobe.com/flex/201/langref/package.html#escape%28%29
精彩评论