uicode 解码

//unicode编码以\u开头

- (NSString*)replaceUnicode:(NSString*)unicodeStr

{

NSString*tempStr1 = [unicodeStrstringByReplacingOccurrencesOfString:@"\\u"withString:@"\\U"];

NSString*tempStr2 = [tempStr1stringByReplacingOccurrencesOfString:@"\""withString:@"\\\""];

NSString*tempStr3 = [[@"\""stringByAppendingString:tempStr2]stringByAppendingString:@"\""];

NSData*tempData = [tempStr3dataUsingEncoding:NSUTF8StringEncoding];

NSString* returnStr = [NSPropertyListSerializationpropertyListFromData:tempData

mutabilityOption:NSPropertyListImmutable

format:NULL

errorDescription:NULL];

return[returnStrstringByReplacingOccurrencesOfString:@"\\r\\n"withString:@"\n"];

}

你可能感兴趣的:(uicode 解码)