// 先使用 UTF-8字符串 转译成 ISO
NSString *str1 = [ DATA_Str stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; // 转译成 UTF-8 字符串
char converted[([str1 length] + 1)];
[str1 getCString:converted maxLength:([str1 length] + 1) encoding: NSISOLatin1StringEncoding]; // 转译成 ISO
NSString *converted_str = [NSString stringWithCString:converted encoding:NSISOLatin1StringEncoding]; // 转译成 ISO 字符串
转换成ISO Data
NSStringEncoding enc=CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingISOLatin1);
NSData * Data = [responseStr dataUsingEncoding:enc]; // 二进制文件
网友评论