users@jersey.java.net

[Jersey] Charset question

From: Simon Roberts <simon_at_dancingcloudphotography.com>
Date: Tue, 31 Mar 2015 17:09:52 -0600

Hi all, I have a question; partly this is a philosophical thing, partly it
might have code-level consequences.

If I'm sending structured data (e.g. a JSON object) from the server to the
client, and the structure contains ... er, I'm not even sure of the right
terminology, I want to call them "high order Unicode characters", or "text
that's not plain ASCII" .. I think there are some things I need to pay
attention to, but I'm not sure what they are.

Can someone give me an outline of the concerns and mechanisms, in
particular, what does JAX-RS handle automatically, and what do I have to do?

For example, suppose I'm trying to send some Chinese text in JSON. Does the
JSON conversion have to know the target charset? If so, does JAX-RS tell
it? Does the JAX-RS infrastructure check the accept-charset header and will
it ensure the right response? So, for example, if the client asks for some
specific ISO-8859 character set, but my server machine generally runs in
UTF-8, will (good) magic occur on output? How about on input? And if magic
isn't magical, what do I have to do to make this work.

BTW, I realize this is a potentially large topic, so a reference would be
fine. I tried to look in the Jersey docs, and didn't find anything (might
have missed it, of couse!)

Many thanks,
Simon

-- 
Simon Roberts
Certified Professional Photographer
http://dancingcloudphotography.com
(303) 249 3613