We are having a problem with XML data wich already have de UTF-8 header (<?xml>). The problem is that we would like to save the string that contain the XML formatted data to a file (.xml of course). Does WM have a service like “save XML file” that will give us the option of “Encoding” the file with the right encoding format, in our case UTF-8. I’m asking because even if we simply save the file to disk, it need to be “encoded” to UTF-8 to permit special caracters.
Patrice,
Work around is once you have XML IDATA(document)in the pipeline then use documentToRecord or DocumentToXMLString in the service input set @encoding=UTF-8.This will create the xmldata having with ?xml version=1.0 encoding=UTF-8 in the xmlstring.So save the xml using WmSamples writeToFile with (.xml).
HTH,
RMG
I already know how to put this “xml version=1.0 encoding=UTF-8” in my XML file! The problem is that it’s not because you put “@encoding=UTF-8” that the writeToFile service will understand that it has to save and encode the file to UTF-8. The writeToFile service write to a file in ANSI/plain text format. The real solution is to re-write the writeToFile service with the good Java class:
//
OutputStream fout= new FileOutputStream(strFullFilename, blnOverWrite);
OutputStream bout= new BufferedOutputStream(fout);
OutputStreamWriter out = new OutputStreamWriter(bout, “UTF8”);
out.write(strData);
out.flush();
out.close();
//
Hope that this will help others.
Patrice
Patrice,
Thanks for update…i might understood your question differently…ignore my post…