Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8368

Re: "Invalid UTF-8 start byte 0xbf" when changing universes

$
0
0

Thanks, Anthony.

 

I did resolve it, with a similar solution.

 

I found that although I was transforming the XML to a String with the proper UTF-8 encoding, my String was later being decoded when it was being written to the output stream of the URLConnection. So now I just transform the encoded node directly to the OutputStream:

 

 

requestXML.toOutputStream(connection.getOutputStream());

 

 

public void toOutputStream(OutputStream os) 
throws XMLUtilityException
{    Transformer transformer;    try    {        transformer = XMLUtilities.transformerFactory.newTransformer();        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");        transformer.transform(new DOMSource(node), new StreamResult(os));    }    catch (TransformerException e)    {        throw new XMLUtilityException("Unable to render XML.",e);    }
}

seems to be working.

 

Never had to worry about this stuff with REBean!


Viewing all articles
Browse latest Browse all 8368

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>