Hello to all.

I'm currently facing the same problem as smallufo: I have a simple JAX-RS
implementation with a class that uses the
"@ProduceMime("text/plain;charset=UTF-8") and one of its methods "@GET
@Path("/getActions") public String getActions() { return "é"; }". Everytime
I open a browser on the corresponding method, the plain text is not properly
encoded in the browser. My HTTP trace from a sniffer is:

http://localhost:9999/act/test

GET /act/test HTTP/1.1
Host: localhost:9999
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; fr; rv:1.9.0.3)
Gecko/2008092414 Firefox/3.0.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 3
Server: Jetty(6.1.9)



I must also indicate that my Java source file encoded is "ISO-8859-1" and
that I've set the javac compiler accordingly. I'm using the jetty built-in
web server via spring via a

<jaxrs:server
    id="cxf.server.ApplicationConfigurationService"
    address="http://localhost:9999/";
>
  ...
</jaxrs:server>

and that I'm on CFX v2.1.2. I'm wondering whether the problem would not come
from the jetty configuration itself... Did I miss something, please? What
else should I do in order to have the returned string properly encoded (I've
tried the implementation of the method "new String(new
String("é").getBytes("UTF-8"), "UTF-8")")?

Thank you for your help.
Regards,
Édouard


smallufo wrote:
> 
> Thank you for replying so soon
> It works , thanks a lot.
> 
> 
> 2008/10/6 Sergey Beryozkin <[EMAIL PROTECTED]>:
>> Hi,
>>
>> Try @ProduceMime("application/json;charset=UTF-8")
>>
>> Cheers, Sergey
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/JAX-RS-%3A-How-to-change-encoding-or-charset---tp19836607p20175177.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to