0

以下に示すjson解析から文字列を取得しました

{"categories":[{"Id":"4","name":"hm\u00c3\u0080\u00c2\u00afI\u00c3\u0084"},{"Id":"257","name":"Atkmkntbj\u00c2\u00b3"},{"Id":"258","name":"kv]ncnNz\u00c3\u00b0"},{"Id":"259","name":"tlm\u00c2\u00abv Uo\u00c3\u00b0kv"},{"Id":"260","name":"hnt\\mZw"},{"Id":"265","name":"kvs]jy\u00c3\u00b0kv"},{"Id":"273","name":"tImfwkv"},{"Id":"278","name":"Fgp\u00c2\u00afv"},{"Id":"285","name":"tNmtZym\u00c2\u00afcw"},{"Id":"290","name":"BiwkI\u00c3\u0084"},{"Id":"291","name":"\u00c2\u00a2mknss^Uvkv"}]}

私はコードを使用します

list = [(NSDictionary*)[responstring JSONValue] objectForKey:@"categories"];

NSLog(@"%@\n\n",list);

for (int i = 0; i<[list count]; i++)

{

    NSDictionary *dict = (NSDictionary *) [list objectAtIndex:i];

    [array_maincategory addObject:[dict objectForKey:@"name"]];

    NSLog(@"value = %@",[array_maincategory objectAtIndex:i]);

}

私はこのような応答を得る

2012-11-21 09:29:01.784 BritishMalayali[412:fb03] value = hmÀ¯IÄ

2012-11-21 09:29:01.786 BritishMalayali[412:fb03] value = Atkmkntbj³

2012-11-21 09:29:01.787 BritishMalayali[412:fb03] value = kv]ncnNzð

2012-11-21 09:29:01.789 BritishMalayali[412:fb03] value = tlm«v/ Uoðkv

2012-11-21 09:29:01.790 BritishMalayali[412:fb03] value = hnt\mZw

2012-11-21 09:29:01.791 BritishMalayali[412:fb03] value = kvs]jyðkv

2012-11-21 09:29:01.793 BritishMalayali[412:fb03] value = tImfwkv

2012-11-21 09:29:01.794 BritishMalayali[412:fb03] value = Fgp¯v

2012-11-21 09:29:01.797 BritishMalayali[412:fb03] value = BiwkIÄ

上記の応答では、一部のテキストが欠落しています。必要な応答は次のようになります hm\u00c3\u0080\u00c2\u00afI\u00c3\u0084

正しい応答を得るのを手伝ってください

4

1 に答える 1

0

これは、文字列のエンコーディングに関連する問題です。解決策については、この質問を参照してください。

于 2012-11-21T05:06:32.473 に答える