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
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
Thanks Daniel for your response,
In my app, the user enters a name in japanese language which is to be
sent to server in a JSON request.The server expects the name parameter
in form of a UTF-8 encoded string.
So the encoding of source code should not matter.Here is the sample code
\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
It looks like the code you are using is adding the extra \ here:
strJson = start + \\u file://u/ +
strHex.substring(strHex.length()-4)+ end;
I don't understand the need for the EncodeJson function. As I pointed out
earlier, Java stores char and String data internally as sequences of 16-bit
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
Alok,
On Fri, Nov 12, 2010 at 3:56 PM, Alok Kulkarni kulsu...@gmail.com wrote:
Thanks Daniel for your response,
In my app, the user enters a name in japanese language which is to be
sent to server in a JSON request.The server expects the name parameter
in form of a UTF-8 encoded string.
In
Yes it won't compile, but I think you are supposing that (\\u file://u/
+ 3403) is the same as \u3403. At any rate, I still thing the EncodeJson
function is bogus.
AFAIK, the JSON encoder should take care of the UTF-8 encoding. It could
also use JSON encoding.
--
You received this message
On Fri, Nov 12, 2010 at 4:33 PM, Frank Weiss fewe...@gmail.com wrote:
Yes it won't compile, but I think you are supposing that (\\u + 3403) is
the same as \u3403. At any rate, I still thing the EncodeJson function is
bogus.
AFAIK, the JSON encoder should take care of the UTF-8 encoding. It
9 matches
Mail list logo