users@jersey.java.net

Re: [Jersey] Jersey client not sending UTF-8 characters

From: Hubert Le Van Gong <Hubert.Levangong_at_Sun.COM>
Date: Mon, 18 Jan 2010 22:35:22 +0100

I have run into a very similar issue lately.
One thing that Paul (Sandoz) mentionned when discussing this is that
some platforms
(e.g. macs using OS X) do not default to UTF-8 but for instance to
ISO-8859-1 (Latin-1)
in the English locale. Maybe this is the case here?

Some possible solutions:
- Use Document.class as the class in webResource.get() or post().
- Make sure strings are created with Charset.forName("UTF-8")

HTH
Hubert


On Jan 18, 2010, at 8:29 PM, Guillaume Bilodeau wrote:

> Hi guys,
>
> We're using Jersey 1.0.3 to implement a REST client. This client
> needs to post an XML envelope containing UTF-8 characters. When
> debugging within Eclipse, we can see that the entity that is being
> sent is correct (all accentuated characters are displayed properly).
> However, intercepting this request using TCPMon shows garbled
> accentuated characters. We've dug into the Jersey source code and it
> seems to be using an OutputStream that uses UTF-8, so we're a bit
> stumped here.
>
> Any ideas why we're observing this behaviour?
>
> Thanks,
> GB
>

--
Hubert A. Le Van Gong
Identity Architect
Sun microsystems, Inc.
17 Rue Duprey
Grenoble, 38000
France
--------------------------------------------------
email: hubert.levangong_at_sun.COM
tel:+33 4 7663 0935
blog: http://blog.levangong.com/
N 45  11.900'
W 005  44.145'
Elev. 736 ft.