Re: [json-lib-user] json-lib and Unicode
Brought to you by:
aalmiray
From: Kiril <kir...@gm...> - 2008-06-14 00:07:05
|
Hi again, I figured out the problem with the XMLSerializer, but now I have the same issue with JSONSerializer. The code is pretty simple (may be this is the problem?:)): JSONObject jsonObject = new JSONObject(); jsonObject = (JSONObject)JSONSerializer.toJSON(item); return jsonObject.toString(3); item has some member strings with unicode/utf-8 encoding. I examined the jsonObject and saw that the unicode values are preserved. The problem appears to be with the toString() method - I seem to get plain ASCII at this point... Many thanks in advance! Kiril. On Wed, Jun 11, 2008 at 2:22 AM, Andres Almiray <aal...@ya...> wrote: > Hi Kirill, > > In theory Json-lib shouldn't have any trouble at all handling unicode > strings. > Regarding the XMLSerializer, did you try setting a particular encoding with > xmlSerializer.write( json, encoding ) ? > > Cheers, > Andres > > > > ----- Original Message ---- > From: Kiril <kir...@gm...> > To: jso...@li... > Sent: Tuesday, June 10, 2008 10:31:14 PM > Subject: [json-lib-user] json-lib and Unicode > > Hi all, > > I have classes that serialize Ok to json, but how should I handle Unicode > strings? > Is there any special pre-processing that needs to be done? > > Also, using XMLSerializer().write(json) returns an XML which is not encoded > properly as Unicode, thought the <?xml... instruction sets UTF-8 encoding. > > Thanks in advance, > > Kiril. > > |