如何从ios中的json响应中获取utf 8编码的String的值

时间:2014-05-12 08:46:41

标签: ios utf-8 utf8-decode

这个问题可能看起来很愚蠢,但我一直试图解决它。任何帮助表示赞赏。 这就是我的回应json的一部分:

{
            code = CAD;
            country = Canada;
            "currency_id" = 3;
            "symbol" = "$";
        },
                {
            code = CZK;
            country = "Czech Republic";
            "currency_id" = 4;
            "symbol" = "K\\xc4\\x8d";
        },...

symbol ”字段令我头疼。

NSString *string = @"K\\xc4\\x8d";
const char *utf8string = [string UTF8String];
NSString *encodeString = [NSString stringWithUTF8String:utf8string];
NSLog(@"convertedString: %@", encodeString);

此代码似乎不起作用。它打印'K \ xc4 \ x8d'。

请告诉我如何获得所需的输出,即“”?

提前致谢。

0 个答案:

没有答案