On Fri, Nov 12, 2010 at 3:01 PM, Alok Kulkarni <kulsu...@gmail.com> wrote:
> Hi,
> I am having a unicode string "\u3403" which is actualy some japansee character
> I want to pass it through a JSON object. So i put the value as say
> String str =  "\u3403"
> jsonObject.put("name",str);
> When i do this  the json object internally adds another escape
> sequence as  "\\u3403", and the request string has two "\" slashes.
> This is interpreted wrongly by the server as it does not detect
> unicode name.
> What can i do for this ?
> Thanks,
> Alok.

Alok,

"\u3403" is not a unicode string, but a string that has hex code of an
unicode character in it. It can be unicode encoded or its encoding can
be anything else really.
Since "\" is a special character and has extra meaning in Java String
class, it gets escaped by escape character, which is "\". Now you
know, what is the extra meaning of "\"  ;-)

Now JSON should not have any problems with parsing such
character/string, even when double escaped. Make sure that your server
is correctly configured for use of unicode.
Also try sending the actual character (paste it from some place that
generates a character based on its hex code), but please make sure
that your source code is unicode encoded, otherwise it will not work.

Daniel

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to