开发者

Replace tab in NSString with \t

开发者 https://www.devze.com 2023-04-04 07:08 出处:网络
I\'m parsing json with SBJson. I receive an error \"-JSONValue failed. Error is: Unescaped control character [0x09]\" when parsing my json string, it has unen开发者_运维技巧coded tab. How to replace t

I'm parsing json with SBJson.

I receive an error "-JSONValue failed. Error is: Unescaped control character [0x09]" when parsing my json string, it has unen开发者_运维技巧coded tab. How to replace this tab in my json string to \t? If i remove tab manualy, everything is good. Or how to encode this tab properly?


You can use stringByReplacingOccurrencesOfString:withString::

NSString * newJsonString = [oldJsonString stringByReplacingOccurrencesOfString:@"\t" withString:@"\\t"];
0

精彩评论

暂无评论...
验证码 换一张
取 消