unicode转汉字例如服务器给我们的原始字符串为
需要转为中文该怎么办呢?\号后面加个字符就会被转译成其他字符,烦躁,冷静下还是老实写吧,参考了圈,这个方法最好用
- (NSString*) replaceUnicode:(NSString*)TransformUnicodeString{NSString*tepStr1 = [TransformUnicodeString stringByReplacingOccurrencesOfString:@"\\u"withString:@"\\U"];NSString*tepStr2 = [tepStr1 stringByReplacingOccurrencesOfString:@"\""withString:@"\\\""];NSString*tepStr3 = [[@"\"" stringByAppendingString:tepStr2]stringByAppendingString:@"\""];NSData*tepData = [tepStr3 dataUsingEncoding:NSUTF8StringEncoding];NSString*axiba = [NSPropertyListSerialization propertyListWithData:tepDataoptions:NSPropertyListMutableContainersformat:NULLerror:NULL];return [axiba stringByReplacingOccurrencesOfString:@"\\r\\n"withString:@"\n"];}复制代码