0

i have a problem with a json response of an HttpPost , the resposnse contains character like & hellip; and this cause to generate an exception while creating the jsonobject or a jsonarray.

Anyone knows how decode it? i have to add an header in the request?

thanks a lot.

edit:

i already used log cat and this is the exception

11-02 09:17:54.472: WARN/System.err(1382): org.json.JSONException: Value XXXXXX& hellip; at authors of type java.lang.String cannot be converted to JSONArray 11-02 09:17:54.492: WARN/System.err(1382): at org.json.JSON.typeMismatch(JSON.java:96) 11-02 09:17:54.492: WARN/System.err(1382): at org.json.JSONObject.getJSONArray(JSONObject.java:548) 11-02 09:17:54.492: WARN/System.err(1382): at org.liquidjournal.httpProxy.ResourceManager.getAuthors(ResourceManager.java:127) 11-02 09:17:54.492: WARN/System.err(1382): at org.liquidjournal.MyJournalGroup$PostResource.doInBackground(MyJournalGroup.java:291) 11-02 09:17:54.492: WARN/System.err(1382): at org.liquidjournal.MyJournalGroup$PostResource.doInBackground(MyJournalGroup.java:1) 11-02 09:17:54.492: WARN/System.err(1382): at android.os.AsyncTask$2.call(AsyncTask.java:185) 11-02 09:17:54.492: WARN/System.err(1382): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 11-02 09:17:54.492: WARN/System.err(1382): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 11-02 09:17:54.492: WARN/System.err(1382): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068) 11-02 09:17:54.492: WARN/System.err(1382): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561) 11-02 09:17:54.492: WARN/System.err(1382): at java.lang.Thread.run(Thread.java:1102) 

& hellip ; is converted directly by stack overflow

2
  • Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your exception. Commented Nov 2, 2010 at 8:41
  • this is an ecoding problem, i think. Commented Nov 2, 2010 at 8:52

1 Answer 1

1

Maybe it's not an encoding problem: from the error log I see, that you try to convert a String to a JSONArray. I'm not an expert in the JSON domain, but a JSONArray is a collection and I'd expect that you try to add the String (including the ellipse char) to the (existing) JSON array rather then trying to make an array from the String.

JSON expects all Strings to be in UTF-8 format, so it really should be able to handle the ellipse char.

Sign up to request clarification or add additional context in comments.

1 Comment

you are right , i have posted the wrong log. this problem there is when i try to use the content with & hellip; as a url parameter

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.