I want to convert all strings on my form to utf-8 encoding. I want to be sure that all strings are in utf-8 encoding before I will call applyXSL method. I tried something like this but its not working. Any ideas?
var xmlData = xfa.data;
var xmlStr = util.stringFromStream(xmlData, "utf-8");
var xfa = XMLData.parse(xmlStr,false);
First, "xfa.data" is an XML node not a stream. Specifically it's already an XMLData node so there is no need to reparse it. And second, even if it was a stream, the "utf-8" input argument to "stringFromStream" indicates the encoding of the data in the stream, not a conversion.
To get a string out "xfa.data" use:
xfa.data.saveXML();
You can convert it to a stream with UTF-8 encoding, but this won't help. All strings in JavaScript are encoded with "UTF-16", it's automatic.
You also cannot overwrite, or redefine the xfa node. This is a non-generic parameter, meaning that its connected to data underneath the covers in Acrobat.
What is it that you are trying to accomplish?
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script