Ah, yes, interpreting them as two hex digits certainly makes more sense
than my original Unicode guess.

According to JSON.org, \x** is not valid string content:

http://www.json.org/

... which is probably why the parser throws the backslashes away.

TextUtils.htmlEncode won't help because that's encoding, not decoding, and
those are not HTML entities anyway (which look like &#AB; etc.)

Yes, you might need to write your own code to scan for and replace the
\x-codes.

I would do it as a simple state machine, iterating the string one character
at a time, and keeping state (whether the most recent data was a backslash,
a backslash followed by an 'x', etc.)

Be careful as to not introduce any double-quote characters into the
intermediate string without escaping: e.g. \x22quoted\x22 should probably
decode to "quoted\" not "quoted"...

-- K

2012/6/14 wdziemia <wdzie...@gmail.com>

> The Characters are ASCII(hexadecimal notation), that im sure off. Compare
> feeds from Google to the raw JSON data shows this aswell.
>
> http://www.asciitable.com/
>
> \(escape) :: x(signifies 2 char hex value) :: 3c(the hex value)
>
> \x3c = <
>
> \x3c = >
>
> The above uses the Hex values for the characters. These characters could
> be converted to there respected symbols. These characters are then make up
> a HTML Entity code. See below:
>
> \x26#39; == &#39; == ' (an apostrophe)
>
> Another simple way to check is typing the following:
> javascript:alert('\x3c\x3e\x3c\x26'); into the address bar.
>
> Oh, and what is the meaning of using BufferedReader with an 8-character
>> buffer?
>
>
> I found a tutorial online for showing how to get JSON input via URL.
> I didn't question the code but now that you noticed it, it doesn't make
> sense(to my limited knowledge). Since the purpose of a buffered reader is
> increase efficiency by buffering large sets of data at one time, limiting
> the buffer size to 8 bytes nullifies its purpose , correct?
>
> I can use TextUtils.htmlEncode to handle any HTML entity codes but
> getting the ASCII hex values to character values is proving a bit
> challenging. Would i need to store the data into a byte array and then work
> on the byte array?
>
> --
> 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