Hi, I develop on Windows and deploy on AIX. On both OS, I get the same result.
Thanks for the tips on Eclipse. I have made the change but the characters are still not displayed correctly. BTW, I use SoapUI to submit the request, and I set the Encoding to UTF-8. regards, Loh Kok Jeng On 24 June 2010 13:22, Ron Grimes <[email protected]> wrote: > Have you considered that it is not the conversion to UTF-8 that is incorrect, > but the software you're using to display the log? For example, when viewing > logged results to the Eclipse console, it will do a similar thing if you do > not go into Preferences and change the "text file encoding" to UTF-8. I don't > recall you mentioning your development box O/S or the software used to show > the log. But, it is possible that is the culprit. Or not, but something to > check. > > Ron > > > ________________________________________ > From: Loh Kok Jeng [[email protected]] > Sent: Wednesday, June 23, 2010 7:24 PM > To: [email protected] > Subject: Re: UTF-8 Characters in Request Params for REST Service > > On 24 June 2010 09:11, Loh Kok Jeng <[email protected]> wrote: >> Hi Sergey, >> >> This is for form based submission. >> >> Below is a snippet of my code. I want to be able to accept non-ASCII >> characters in "message" parameter below. However, when I tested with >> Chinese characters, they are converted to "?" as shown in my logs. >> >> Any help will be very much appreciated. >> >> @POST >> // @Consumes("application/x-www-form-urlencoded") >> public SMSSendSmsResponse sendSms(@HeaderParam("Authorization") >> String authorization, >> �...@context MessageContext mc, >> @FormParam("address") List<String> address, >> �...@formparam("message") String message, >> �...@formparam("notifyURL") String >> notifyURL, >> �...@formparam("correlator") String >> correlator, >> �...@formparam("senderName") String >> senderName, >> �...@formparam("Charging") String >> Charging) >> throws MalformedURLException, PolicyException, ServiceException { >> >> if (address != null) { >> for (Iterator<String> i = address.iterator(); i.hasNext();) { >> log.info("Address: " + i.next()); >> } >> } >> log.info("Message: " + message); >> log.info("Notify URL: " + notifyURL); >> log.info("Correlator: " + correlator); >> log.info("Sender Name: " + senderName); >> log.info("Charging: " + Charging); >> >> .... >> >> } >> regards, >> Loh Kok Jeng >> >> >> >> On 24 June 2010 02:00, Sergey Beryozkin <[email protected]> wrote: >>> I need to know the details of the request and how a resource method >>> expecting the values looks like >>> >>> thanks, Sergey >>> >>> On Tue, Jun 22, 2010 at 7:10 PM, Rakesh Rai <[email protected]> wrote: >>> >>>> 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. >>>> > > >>>> > >>>> >>> >>
