java - JAXB enoding issue when marshalling to System.out -
i'm trying print console java bean, unmarshalled http response. have issues encoding. here's part of response:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <response> <errormsg>Ä°ÅŸleminizi ...</errormsg> </response>
my method is:
public void printtoconsole() { try { jaxbcontext context = jaxbcontext.newinstance(response.class); marshaller marshaller = context.createmarshaller(); marshaller.setproperty(marshaller.jaxb_formatted_output, boolean.true); marshaller.setproperty(marshaller.jaxb_encoding, "utf-8"); marshaller.marshal(this, system.out); } catch (jaxbexception e) { e.printstacktrace(); } }
by viewing bean values debugger, they're shown correctly in debugger's pop-up(eclipse ide)
thanks
the problem using default console settings, not able print utf-8 characters properly. make sure console use display output encoded in utf-8. example, in eclipse , need go
run configuration > common > encoding
and select utf-8 or relevant encoding.
Comments
Post a Comment