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.

enter image description here


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -