I'm having a problem with FileStream. I have an XML that I
loaded from the hard drive, edited in my AIR app and I want
to write it
back to the hard drive. It includes special characters such
as the TM
symbol, which I've been unable to find a way to write to the
...it writes "â„¢" instead of the TM symbol.
And if I use UTF-8 it just writes the
Something else that's a bit odd, and perhaps related: If I
save any .xml file, created in a text editor, as UTF-8 encoding it
breaks when I try to load it into AIR using FileStream. But if I
save it as ANSI it works.. even when I use "UTF-8" in the
readMultiByte function. Which I have to do or it loses the special
characters like the TM symbol, which it turns into "â?¢"
when I use "iso-8859-1".
This is the way that works for me. You need to use UTF-8
var fileName = "myXMLFile.xml"
var fileRef:FileReference = new FileReference()
var fl:File =
var fs:FileStream = new FileStream();
var xDoc:XMLDocument = new XMLDocument(myXML)
var xStr = xDoc.toString()
//open file in write mode
//write bytes from the byte array