This is the method that does the trick.... converts to UTF-8 and transforms
to UTF-8 format string and sends it back to the caller
Wherever in your service class / action class add this method and convert
the existing string to return the UTF-8 transformed string / text
/**
*
* @param utfEightString
* @return String converted to USF-8 format and send it to the caller .
* @throws java.io.
UnsupportedEncodingException
*/
public static final String utfEightConvert(String utfEightString)
throws java.io.UnsupportedEncodingException {
byte[] bytes = new byte[utfEightString.length()];
for (int i = 0; i < utfEightString.length(); i++) {
bytes[i] = (byte) utfEightString.charAt(i);
}
return new String(bytes, "UTF-8");
}
Hope it helps.
Rakesh
On Tue, Jun 22, 2010 at 1:47 PM, Sergey Beryozkin <[email protected]>wrote:
> Is it a form based submission ? or XML is posted in the body ?
>
>
> cheers, Sergey
>
> On Mon, Jun 21, 2010 at 6:00 PM, Loh Kok Jeng <[email protected]>
> wrote:
>
> > Dear all,
> >
> > I'm struggling with non-ASCII characters passed in request params of a
> > REST service. The characters become ? when received by my app
> > developed using CXF. The encoding is set to UTF-8 by the REST client.
> > Why do I get "?"?
> >
> > Thanks in advance.
> >
>