xml - Java: encoding changes from utf-8 to utf-16 -


i have function has return json jsp.

the information have return xml document.

the document has actualencoding = "utf-8" when convert string, utf-16.

any ideas?

here code:

document doc = null; doc = orgw3cdomutils.obtenerdocumentdebyte(bytes); objectwriter ow = new objectmapper().writer().withdefaultprettyprinter(); string json = ow.writevalueasstring(doc); jsresponse.getdata().put("respuesta", json); 

and method obtenerdocumentdebyte gets document byte array:

public static document obtenerdocumentdebyte(byte[] documentoxml) throws exception {     documentbuilderfactory factory = documentbuilderfactory.newinstance();     factory.setnamespaceaware(true);     documentbuilder builder = factory.newdocumentbuilder();     return builder.parse(new bytearrayinputstream(documentoxml)); } 

thanks in advance


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -