[xml] ascii 172 being added
Hello,
I started off by pulling text from a textFrame which had "© LICENSING". I stored this string to an xml object (variable name of 'x'), and then wrote it to an xml file like so:
filePath.encoding = 'UTF8';
filePath.open('w');
filePath.write(x.toXMLString());
filePath.close();
Now when I look in the xml file, it has the actual copyright symbol character instead of & # 1 6 9 ; (I added spaces so hopefully this won't be converted in the message).
Seems that if my xml file contains a copyright symbol character, then if I pull that data and store that to an XML object in InDesign, then it adds ASCII character 172 before that copyright symbol. If I then put that in a textFrame, you can't see that character (ASCII 172) but if you use the arrow keys you can tell that it's there.
Any ideas on why ASCII 172 is being added before the copyright symbol? By the way, I'm using InDesign CS5.5 on OS X Lion.
Here's an example of the xml data that was saved to the xml file:
<?xml version="1.0" encoding="UTF-8"?>
<cbAttrs version="1.0">
<copyright id="10-1" w="69.16" h="32.1990625000001" x="-57.2081831359861" y="243.181297317146">© LICENSING</copyright>
</cbAttrs>
And here's the code I'm using to pull the data in from the xml file:
var xmlPath = File('/Path/to/xml');
if (xmlPath.open('r')) {
var xmlText = xmlPath.read();
xmlPath.close();
var x = XML(xmlText);
}
var a = x.copyright.toString();
$.writeln(a[0].charCodeAt());
$.writeln(a);
Which gives me:
172
© LICENSING
Thanks for looking at my questions.
