See if you can make heads or tails out of this behavior. I couldn’t.
var myXML:XML = <doc><foo>— & < > " ' </foo></doc> trace (myXML) //
trace (myXML.toXMLString()) // &mdash; & < > " ' ﾠ trace (myXML.toString()) // &mdash; & < > " ' ﾠ trace ("--") // trace (myXML.foo) // — & < > " ' ﾠ trace (myXML.foo.toXMLString()) // &mdash; & < > " ' ﾠ &mdash; & < > " ' ﾠtrace (myXML.foo.toString()) // — & < > " ' ﾠ
Why are single and double quotes (and nonbreaking spaces?!) DEcoded by toXMLString, but any entities (ampersands) Flash doesn’t handle get (re)ENcoded?
What a nightmare! I’m no encoding expert (although I did drop some cheddar on O’Reilly’s excellent “Fonts and Encodings,” a 1000+ page sleep-aid I have had zero time to actually read), but is there a rationale here I can’t see?
Still musing about what to do about it.