开发者

TouchJSON - Why I get lots of \U**** in the results of parsing?

开发者 https://www.devze.com 2023-03-14 16:03 出处:网络
I am using TouchJSON to parse a JSON data. In the results, the strings in the array are all in \\U** format.

I am using TouchJSON to parse a JSON data.

In the results, the strings in the array are all in \U** format.

Yes, t开发者_开发技巧hey are meant to be other languages than English.

Why TouchJSON can't just replace them with real string via UTF8?

How should I deal with the results if I want to store them as NSStrings and use them in UILabel?

Thanks


The leading \u should not be a part of the string, but rather an identifier. If you load an NSString from parsed NSDictionary, it should've ignored the leading \u.

If it did not, you can always use [theString substringFromIndex: 2] to remove any leading identifiers.

Otherwise, take a look at SBJson, an alternative library for Objective-C JSON parsing.

0

精彩评论

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