Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with unescapeHTML #267

Open
laszlotuss opened this issue Nov 7, 2013 · 0 comments
Open

Issues with unescapeHTML #267

laszlotuss opened this issue Nov 7, 2013 · 0 comments

Comments

@laszlotuss
Copy link

Hy there, i have problems using unescapeHTML with a json object.

NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSString *returnString = [[NSString alloc] initWithBytes: [data bytes] length:[data length] encoding: NSUTF8StringEncoding];
return [[returnString unescapeHTML] dataUsingEncoding:NSUTF8StringEncoding];

And that returned NSData will send to a simple JSON parser:

[NSJSONSerialization JSONObjectWithData:data options:0  error:&jsonParsingError];

And most of the time it works as i expected.
What i expect is to replace all """ and all "'".
(actually this "'" have a 0 before 39 in my case, so i have to extend the method for work for that also)

But when it comes to a big json string, it failed to convert one """ and it will rise an NSError at parsing like:

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn't be completed. (Cocoa error 3840.)" (Badly formed object around character 6177.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant