I have this piece of the code:
(I hope that all of you, with your encoding, can see the second line)

org.w3c.dom.Element e1 = doc.createElement("element1");
Node n1 = doc.createTextNode("ČĆŽŠĐčćžšđ");
e1appendChild(n1);

and I serialize it as:

ByteArrayOutputStream bas = new ByteArrayOutputStream();
OutputFormat of = new OutputFormat("XML", "UTF-8", false);
XMLSerializer serializer = new XMLSerializer(bas, of);
serializer.asDOMSerializer();
serializer.serialize(doc);
bas.close();
byte[] b = bas.toByteArray();

and then I save it to the disk with FileOutputStream.write(byte[]) method.

Well, the problem is that this doesn't work and those special characters lost 
and being replaced with question marks (?).

What should I do?




      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Reply via email to