J
janib
I have a problem when transforming text containing the swedish letters
"å", "ä" and "ö". If I do
Transformer t =TransformerFactory.newInstance().newTransformer();
t.setOutputProperty( OutputKeys.METHOD, "xml");
t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
t.setOutputProperty( OutputKeys.INDENT, "yes");
t.setOutputProperty( OutputKeys.ENCODING, "ISO-8859-1"); <------- *
t.transform( new DOMSource( document), new StreamResult( output ) );
return output.toString( );
I get an xml-file containing broken characters (=?) for the swedish
letters:
<?xml version="1.0" encoding="ISO-8859-1"?>
....
<channelinfo confirmed="true" validate="false" name="Internet">
<publishdate>1154940455898</publishdate>
<unpublishdate>1154940455898</unpublishdate>
<attribute name="rooms"/>
<attribute name="year"/>
<attribute name="title">K?pes</attribute> <------------- *
<attribute name="price">20000</attribute>
<attribute name="area"/>
<attribute name="body">Vill k?pa en truck</attribute>
<-------------- *
</channelinfo>
but if I change the encoding to UTF-8:
t.setOutputProperty( OutputKeys.ENCODING, "UTF-8"); <------- *
the letters are alright:
<?xml version="1.0" encoding="UTF-8"?>
....
<channelinfo confirmed="true" validate="false" name="Internet">
<publishdate>1154940455898</publishdate>
<unpublishdate>1154940455898</unpublishdate>
<attribute name="rooms"/>
<attribute name="year"/>
<attribute name="title">Köpes</attribute> <------------- *
<attribute name="price">20000</attribute>
<attribute name="area"/>
<attribute name="body">Vill köpa en truck</attribute>
<-------------- *
</channelinfo>
But the xml has to be formated in ISO-8859-1 so it would be nice if I
could make it work with that encoding.
Anyone know where I can alter this behavior or why it behaves like
above?
"å", "ä" and "ö". If I do
Transformer t =TransformerFactory.newInstance().newTransformer();
t.setOutputProperty( OutputKeys.METHOD, "xml");
t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
t.setOutputProperty( OutputKeys.INDENT, "yes");
t.setOutputProperty( OutputKeys.ENCODING, "ISO-8859-1"); <------- *
t.transform( new DOMSource( document), new StreamResult( output ) );
return output.toString( );
I get an xml-file containing broken characters (=?) for the swedish
letters:
<?xml version="1.0" encoding="ISO-8859-1"?>
....
<channelinfo confirmed="true" validate="false" name="Internet">
<publishdate>1154940455898</publishdate>
<unpublishdate>1154940455898</unpublishdate>
<attribute name="rooms"/>
<attribute name="year"/>
<attribute name="title">K?pes</attribute> <------------- *
<attribute name="price">20000</attribute>
<attribute name="area"/>
<attribute name="body">Vill k?pa en truck</attribute>
<-------------- *
</channelinfo>
but if I change the encoding to UTF-8:
t.setOutputProperty( OutputKeys.ENCODING, "UTF-8"); <------- *
the letters are alright:
<?xml version="1.0" encoding="UTF-8"?>
....
<channelinfo confirmed="true" validate="false" name="Internet">
<publishdate>1154940455898</publishdate>
<unpublishdate>1154940455898</unpublishdate>
<attribute name="rooms"/>
<attribute name="year"/>
<attribute name="title">Köpes</attribute> <------------- *
<attribute name="price">20000</attribute>
<attribute name="area"/>
<attribute name="body">Vill köpa en truck</attribute>
<-------------- *
</channelinfo>
But the xml has to be formated in ISO-8859-1 so it would be nice if I
could make it work with that encoding.
Anyone know where I can alter this behavior or why it behaves like
above?