- (NSString *)replaceUnicode:(NSString *)unicodeStr
{
NSString *tempStr1 = [unicodeStr stringByReplacingOccurrencesOfString:@"\\u"withString:@"\\U"];
NSString *tempStr2 = [tempStr1 stringByReplacingOccurrencesOfString:@"\""withString:@"\\\""];
NSString *tempStr3 = [[@"\""stringByAppendingString:tempStr2] stringByAppendingString:@"\""];
NSData *tempData = [tempStr3 dataUsingEncoding:NSUTF8StringEncoding];
NSString *returnStr = [NSPropertyListSerialization propertyListFromData:tempData
mutabilityOption:NSPropertyListImmutable
format:NULL
errorDescription:NULL];
return [returnStr stringByReplacingOccurrencesOfString:@"\\r\\n"withString:@"\n"];
}
分享到:
相关推荐
php 字符编码转换类,支持ANSI、Unicode、Unicode big endian、UTF-8、UTF-8+Bom 互相转换。
Unicode --> UTF-8 UTF-8 --> ANSI UTF-8 --> Unicode UTF-8 --> Unicode big endian ansi转别的,不检验BOM,一律作为ansi编码进行转换 unicode转别的,首先检验BOM,不合格不转换 utf8转别的,首先检验BOM,不...
lvgl unicode 转 utf-8小工具
Unicode转UTF-8
Txt文件编码批量转换器用于批量转换txt文本文档的编码格式。通常,我们电脑里的txt文件都是ASNI编码,当放到手机或MP3里时,打开看到的往往...目前,它支持ASNI、UTF-8、Unicode和Unicode big endian等编码的相互转换。
最近需要对Linux与Windows平台下的字符传输出现乱码,对...参考了网上的UTF-8/UTF-16转换的资料,只有0x10000以下的Unicode编码进行了转换;对其代码进行了修改和补充,可以实现所有的UTF-8/UTF-16的转换,分享给大家。
PowerBuilder9.0开发环境下,可以把UTF-8的编码转换为Unicode的编码格式,在pb9.0环境下测试通过。
C语言字符编码转换UNICODE、GBK、UTF-8互相转换
文件里有详细的代码,编码格式选择UTF-8编码,亲测在linux下可以直接运行。泰文在osd输出的流程一般是泰文先转换成Unicode编码,然后调用freetype进行文字渲染叠加
如果UNICODE字符由2个字节表示,则编码成UTF-8很可能需要3个字节,而如果UNICODE字符由4个字节表示,则编码成UTF-8可能需要6个字节。用4个或6个字节去编码一个UNICODE字符可能太多了,但很少会遇到那样的UNICODE...
将文本从unicode_escape编码转换为UTF-8编码
PB的utf-8转换,包括加码解码等等 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
utf-8 unicode gb2312 汉字编码
GB2312编码与utf-8编码的字符串的转换,主要使用windows api函数MultiByteToWideChar和WideCharToMultiByte,代码简洁,经测试可用
delphi7调用delphi2009生成的dll文件会出现乱码问题。是unicode的原因 终于找到了UTF-8、Unicode格式转换函数
内容为utf8编码和unicode编码相互转换的C代码,关于utf8和unicode的用途另一篇博客有介绍,请参考。 压缩包 : ntf_code.rar 列表 ntf_code\uni_utf8.h ntf_code\utf8_u.c ntf_code\utf82u.c ntf_code\u2utf8.c ntf_...
文本字符串编码在 Text、ANSI、Unicode、Unicode Big Endian、UTF-8、 UTF-7 之间的互相转换,转换结果使用十六进制表示。
utf-8、ANSI、Unicode相互转化c++实现 std::string ConverANSI2UTF8(const std::string & str); std::wstring ConverANSI2Unicode(const std::string str); std::wstring ConverUTF82Unicode(const std::string str)...
c#源码转换为utf-8,格式为类库,调用即可
各种文本转到 unicode utf-8 gb2312 编码 unicode utf-8 gb2312 编码转换到文字。