Those \x*** look like Unicode characters to me. For example, 0x3cb is the lowercase "u" with those dot things above:
http://www.fileformat.info/info/unicode/char/3cb/index.htm I'm not familiar with JSON character encoding rules, but here is a couple of ideas: 1) Decode the \x** characters yourself before handing the string to the JSON parser 2) Try setting "Accept-Charset: utf-8" on your HTTP request, hopefully the server will notice and not use the \x** sequences at all. Adjust the InputStreamReader to match. Oh, and what is the meaning of using BufferedReader with an 8-character buffer? -- K 2012/6/14 wdziemia <[email protected]> > 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 -- 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

