I agree with RMG, I can correctly generate the header by defining attributes in the top level of my document and setting “generate header” to “true”.
However, setting encoding to true results in HTML encoding not ISO-8859-1 encoding. It appears to me that the pub.xml:documentToString service does not support ISO-8859-1 encoding out-of-the box.
I also did not see any settings in server.cnf that would lead me to believe that you could change this on a server-wide basis.
If there are relatively small number of differences (that you are about, anyway) between HTML encoding and ISO-8859-1 encoding you could use the pub.string:replace built-in service to convert from one to the other or create a java service to leverage existing JDK or custom classes to do this.
I thought I might be able to create a java service that used something like the following to help, but it didn’t work for me.
I’m obviously missing something.