用希伯来语ios加载Json
我正在尝试加载此JSON: {名称:希伯来文字符串, 图像:,类别:希伯来文字符串, 配料:希伯来细绳, 价格:300} 我的代码:用希伯来语ios加载Json,ios,objective-c,json,hebrew,Ios,Objective C,Json,Hebrew,我正在尝试加载此JSON: {名称:希伯来文字符串, 图像:,类别:希伯来文字符串, 配料:希伯来细绳, 价格:300} 我的代码: NSURL *url = [[NSURL alloc] initWithString:@"url"]; NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; AFJSONRequestOperation *operation = [AFJSONRequestOperation JS
NSURL *url = [[NSURL alloc] initWithString:@"url"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
AFJSONRequestOperation *operation = [AFJSONRequestOperation
JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSLog(@"json = %@",JSON);
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(dataretrived)
name:@"JsonFinishLoading"
object:nil];
}failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {}
dta通信出加扰:
Category = "\U05db\U05e8\U05d9\U05da \U05d8\U05d5\U05e0\U05d4";
Image = "";
Ingredients = "\U05d8\U05d5\U05e0\U05d4,\U05e2\U05d2\U05d1\U05e0\U05d9\U05d4";
Name = "\U05db\U05e8\U05d9\U05da \U05d8\U05d5\U05e0\U05d4";
Price = 300;
}....
如何转换数据以使其正确显示 我猜JSON字符串的ASCII字符“\”后跟“U”,后跟“0”,后跟“5”等。您需要将子字符串\U05db转换为unichar 0x05db,然后对每个\UXXXX进行转换。我经常在Xcode中使用希伯莱语,当我对包含希伯莱语的字符串执行NSLog时,它会很好地打印到控制台。数据很好。它是这样记录的,因为NSLog不知道如何显示多字节字符。昨天这里问的问题不是完全一样吗?我没有找到帖子。当我试图在表视图中显示时,你可以发布链接吗?是的,不显示,所以数据不好。上面的第一个字符是。我很确定他们都没事。有一个更简单的解决办法。请参见注释中链接的重复问题。