I am having a problem with data that is a JSON file. I am using the 
following link, from google.

http://www.google.com/finance/company_news?q=AAPL&output=json";

My problem occurs when i want to parse the data and putting it on screen. 
The data is not being decoded properly from some reason.

The raw data(to my understanding its ASCII characters which may make up 
HTML entities):

 1.) one which must have set many of the company\x26#39;s board on the edge of 
their
 2.) Making Less Money From Next \x3cb\x3e...\x3c/b\x3e

When i bring in the data i do the following:

DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();        
BufferedReader reader = new BufferedReader(new InputStreamReader(
                is, "iso-8859-1"), 8); 
StringBuilder sb = new StringBuilder();
String line = null;
        while ((line = reader.readLine()) != null) {
            sb.append(line + "n");
}
is.close();
json = sb.toString();

The Output i receive, using org.json to extract the data from the json 
file, is the following(notice the lack of backslash):

1.)one which must have set many of the companyx26#39;s board on the edge of 
their
2.)Making Less Money From Next x3cbx3e...x3c/bx3e

my current method for handling the first problem by this:

JSONRowData.setJTitle((Html.fromHtml((article.getString(TAG_TITLE).replaceAll("x26",
 "&")))).toString());

the second one escapes me though(no pun intended)

I understand the reason that this doesn't work is being the backlash is 
used for escape characters. In order for this to work, the backslash needs 
to be escaped which would allow . Ive tried many different methods of 
reading the data in but ive had no luck. Is there a way i can import the 
data to handle this problem without using regular expressions?


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

Reply via email to