Hi,

Im having a problem with my castor Marshaller. Check this example:


//Just For testing, this is not production code
Person p = (Person) object;
PrintStream ps = new PrintStream(System.out, true, "UTF-8");

//This line prints the UTF-8 characters correctly :)
ps.println(p.getFullName());


//The actual code that has the problem
//PrintWriter that wraps the SAME Stream used above
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(new PrintStream(baos, true, "UTF-8"));
marshaller.setSuppressXSIType(true);
marshaller.marshal(object,writer);

//This line prints (?) instead of the UTF-8 characters :(
return baos.toString();

Any idea what I'm doing wrong? Please any help will be appreciated.

--Pablo

Reply via email to