I have a spring web project that should now be implemented with cxf and web services.
One function is to output an xml file. I am using the XMLStreamWriter for this task. Everything works fine.
BUT when I add some cxf dependencies into my POM-File, the output xml file gets the "IBM1252" encoding. The xml file can not be read afterwards. Exception: "Invalid encoding name IBM1252" is thrown.
I have added following dependencies:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
I didn't change anything in my code. And I have even tried this:
XMLStreamWriter writer = facOut.createXMLStreamWriter(fileWriter);
writer.writeStartDocument("UTF-8", "1.0");
I still get the "IBM1252" encoding.
Does anyone have an idea what could be the reason for it?