title: actionscript - character escaping
body: <p>In <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/XML.html" rel="nofollow">XML document</a>, characters like carriage-return or quote gets escaped. I'm assuming it does it as described in <a href="http://www.w3.org/TR/1999/WD-xml-c14n-19991109.html#charescaping" rel="nofollow">W3C spec</a>. </p>
  
  <p>In the following code carrriage-return is replaced  by <code>&amp;#xD;</code></p>
  
  <pre><code>var str_carriage_return:String = "hello/rworld";
  var xml_doc:XML = &lt;node myattribute={str_carriage_return} /&gt;;
  var xml_str:String = xml_doc.toXMLString(); //attribute value is hello&amp;#xD;world
  </code></pre>
  
  <p>Is there a built in function in AS3 that can escape these characters in a string without creating XML document?</p>