Philipp,

Thanks, that actually did something different. Now I'm seeing \350\227\215
instead of the characters (not the question marks).

I think I'm pretty close, any idea how to transform these into the actual
characters?

Thanks a lot!

2010/5/19 Philipp Erlacher <[email protected]>

> Hi Pablo,
> you could simply use
>
> StringWriter writer = new StringWriter();
> ...
> return writer.toString();
>
> instead of
>
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> PrintWriter writer = new PrintWriter(new PrintStream(baos, true, "UTF-8"));
> ...
> return baos.toString();
>
> 2010/5/19 pablo fernandez <[email protected]>
> >
> > I'm sorry but I just don't see how that helps me with the Marshaller
> problem.
> > Thanks a lot for taking the time to answer anyway! :)
> >
> >
> > 2010/5/19 Brian Sanders <[email protected]>
> >>
> >> I was able to produce similar results in bsh and then I started to get
> things working, so perhaps this will provide some insight...
> >> bsh % baos = new ByteArrayOutputStream();
> >> bsh % baos.write(new byte[] {0xCE,0xA4,0xCE,0xAD,0xCF,0x82,0xCF,0x84},
> 0, 8);
> >> bsh % print(baos.toString("UTF-8"));
> >> Τέςτ
> >>
> >> I picked some characters from charmap, pasted them into Notepad++, then
> switched to hex mode to get the codes.
> >> ________________________________
> >> From: [email protected]
> >> Date: Tue, 18 May 2010 18:14:38 -0700
> >> To: [email protected]
> >> Subject: [castor-user] Marshaller not properly encoding to UTF-8
> >>
> >> 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
> >> ________________________________
> >> Hotmail has tools for the New Busy. Search, chat and e-mail from your
> inbox. Learn more.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to