I am using Androids JSON library,
The extra "\" in the line

strJson = start + "\\u" + strHex.substring(strHex.length()-4)+ end;

has to be  added as an escape sequence else the code does not compile.

"I don't understand the need for the EncodeJson function."
-Though internally java might be storing as UCS-16, when passing to
the web service , the web service expectes the parameter to be in
UTF-8 encoded string.
Thanks,
Alok.
On Fri, Nov 12, 2010 at 9:42 PM, Frank Weiss <fewe...@gmail.com> wrote:
>> "\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 "\"  ;-)
>>
> This is not correct in Java. Strings are stored internally as UCS-16.
> Therefore, "\u3403".length() == 1. However, "\\u3403".length() == 6. This
> can be verified with a simple Java program.
>
>
> --
> 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

-- 
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