You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Bryan-8 <my...@rnsolutions.com> on 2011/05/17 22:33:09 UTC
jaxrs unicode support
Hi,
when i send a chinese character to my REST service, the data i'm getting is
just garbage characters:
this is my REST service:
@PUT
@Path("/project/{projectId}")
public Response updateProject(@PathParam("projectId") final long projectId,
final String xmlData) {
.....
}
when i send this String: "中文"
printing xmlData results to this: 䏿
I tried using netcat to debug my client and netcat outputs the correct
chinese characters so im sure it a REST service issue.
Is there a way to set character encoding?
I believe i have the correct encoding set, here's CXF logs of the headers:
[05/17/11 16:20:23] DEBUG
org.apache.cxf.transport.http.AbstractHTTPDestination: Request Headers:
{content-type=[application/xml; charset=UTF-8], connection=[Keep-Alive],
Host=[localhost:7001], Content-Length=[39], Content-Type=[application/xml;
charset=UTF-8]}
--
View this message in context: http://cxf.547215.n5.nabble.com/jaxrs-unicode-support-tp4404666p4404666.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: jaxrs unicode support
Posted by Sergey Beryozkin <sb...@gmail.com>.
Sorry for a delay, I've fixed a bug to do with PrimitiveProvider
(which can read Strings) ignoring the charset value.
Charsets are definitely checked on the output and other providers like
JAXB or Form providers are dealing with them properly too. In
meantime, you can easily 'fix' the issue with reading String by
registering a custom String MessageBodyReader
Thanks, Sergey
On Wed, May 18, 2011 at 4:42 AM, Freeman Fang <fr...@gmail.com> wrote:
> Hi,
>
> Take a look at similar discussion[1], I believe it should help
>
> [1]http://cxf.547215.n5.nabble.com/multi-language-support-in-cxf-td569079.html
> Freeman
> On 2011-5-18, at 上午4:33, Bryan-8 wrote:
>
>> Hi,
>>
>> when i send a chinese character to my REST service, the data i'm getting
>> is
>> just garbage characters:
>>
>> this is my REST service:
>>
>> @PUT
>> @Path("/project/{projectId}")
>> public Response updateProject(@PathParam("projectId") final long
>> projectId,
>> final String xmlData) {
>> .....
>> }
>>
>> when i send this String: "中文"
>>
>> printing xmlData results to this: ä¸ æ
>>
>> I tried using netcat to debug my client and netcat outputs the correct
>> chinese characters so im sure it a REST service issue.
>>
>> Is there a way to set character encoding?
>>
>> I believe i have the correct encoding set, here's CXF logs of the headers:
>>
>> [05/17/11 16:20:23] DEBUG
>> org.apache.cxf.transport.http.AbstractHTTPDestination: Request Headers:
>> {content-type=[application/xml; charset=UTF-8], connection=[Keep-Alive],
>> Host=[localhost:7001], Content-Length=[39], Content-Type=[application/xml;
>> charset=UTF-8]}
>>
>>
>> --
>> View this message in context:
>> http://cxf.547215.n5.nabble.com/jaxrs-unicode-support-tp4404666p4404666.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>
> ---------------------------------------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
>
>
>
Re: jaxrs unicode support
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
Take a look at similar discussion[1], I believe it should help
[1]http://cxf.547215.n5.nabble.com/multi-language-support-in-cxf-td569079.html
Freeman
On 2011-5-18, at 上午4:33, Bryan-8 wrote:
> Hi,
>
> when i send a chinese character to my REST service, the data i'm
> getting is
> just garbage characters:
>
> this is my REST service:
>
> @PUT
> @Path("/project/{projectId}")
> public Response updateProject(@PathParam("projectId") final long
> projectId,
> final String xmlData) {
> .....
> }
>
> when i send this String: "中文"
>
> printing xmlData results to this: ä¸ æ
>
> I tried using netcat to debug my client and netcat outputs the correct
> chinese characters so im sure it a REST service issue.
>
> Is there a way to set character encoding?
>
> I believe i have the correct encoding set, here's CXF logs of the
> headers:
>
> [05/17/11 16:20:23] DEBUG
> org.apache.cxf.transport.http.AbstractHTTPDestination: Request
> Headers:
> {content-type=[application/xml; charset=UTF-8], connection=[Keep-
> Alive],
> Host=[localhost:7001], Content-Length=[39], Content-
> Type=[application/xml;
> charset=UTF-8]}
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/jaxrs-unicode-support-tp4404666p4404666.html
> Sent from the cxf-user mailing list archive at Nabble.com.
---------------------------------------------
Freeman Fang
FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference