1

The web service call is failing with the message "Invalid escape sequence found in "" string." being shown through objectLoader:didFailWithError: method.

The JSON that is being fetched from the server has some \ characters and that appears to be the reason for this failure.

How can this be avoided. A quick search says that JKSerializeOptionEscapeForwardSlashes should be sepcifed in JSONKit, but how to implement this with RestKit.

tkanzakic
  • 5,499
  • 16
  • 34
  • 41
OutOnAWeekend
  • 1,383
  • 1
  • 18
  • 36
  • What library are you using to do the JSON parsing? – Madivad Dec 04 '12 at 11:13
  • There is nothing that I am adding separately, RESTKit uses JSONKit. So it is JSONKit. – OutOnAWeekend Dec 04 '12 at 13:03
  • The data I am getting in JSON is in Chinese. The JSON payload has a node as 天坛显 微神经 外科 \351\253\230 级培训班. Yet when I locate the same node in a JSON viewer, it is appearing as 天坛显微神经外科é«级培训班. Why are some of these characters getting 'escaped' along with some numbers? – OutOnAWeekend Dec 04 '12 at 15:29
  • On a closer look, these characters are causing trouble. é « – OutOnAWeekend Dec 04 '12 at 15:32
  • I see two possible errors: 1) I don't think JSON supports the Chinese character set, it's UTF8, and 2) if "\" is an escape sequence, there is an escape for a number of 300+. I haven't had much experience with JSON, so maybe wait for someone else's comments. But have you tried running the website through one of the online validators? – Madivad Dec 04 '12 at 20:47
  • Also, post the JSON URL and we can have a look at it for you – Madivad Dec 04 '12 at 20:48
  • 1
    Ok appears I may be wrong about Chinese character support. Have a look at: http://stackoverflow.com/questions/6718589/unicode-strings-in-json-string – Madivad Dec 04 '12 at 21:10
  • Turned out the JSON was invalid due to the special characters. However, don't understand that how come then that it was formatter properly by http://jsonviewer.stack.hu – OutOnAWeekend Dec 10 '12 at 18:25

1 Answers1

0

Check whether you started your url with "http://" or not?

Mohit Manhas
  • 3,471
  • 1
  • 17
  • 21