+ Start a Discussion
MarceldeBMarceldeB 

XML document with encoding other than UTF-8

Hi, I need to create an XML document with encoding ISO-8859-1.

In the XML header I added the encoding in the tag writeStartDocument, but when running I get the error message:

Underlying stream encoding 'UTF-8' and input paramter for writeStartDocument() method 'ISO-8859-1' do not match

 

Looks like UTF-8 is hard-coded somewhere! could not find any learnings on this apart from a comparable message from 2010 on this. Anyone knows or has a solution for this?

 

XmlStreamWriter la = new XmlStreamWriter();
  la.writeStartDocument('ISO-8859-1', '1.0');
  la.setDefaultNamespace('http://www.pensioenaangifte.nl/schemas/Pensioenaangifte/2012/1/0');
  la.writeStartElement(null,'Pensioenaangifte',null);
   etc...