NSString替换unicode字符 [英] NSString replace unicode characters

查看:130
本文介绍了NSString替换unicode字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用服务器,我必须下载文本到我的iOS应用程序。只有问题:例如éàç等所有字符都被替换为\U008。有没有办法解决这个问题,用正确的字符替换这个代码?

I'w working with a server and I have to download text to my iOS application. Only problem : all characters like "é à ç" are replaced by "\U008" for example. Is there a way to fix this problem, to replace this code by the right character ?

推荐答案

尝试解析接收到的文本textToParse变量):

Try to parse the received text (textToParse variable) with this one:

NSString *encodedString = textToParse;
NSString *decodedString = [NSString stringWithUTF8String:[encodedString cStringUsingEncoding:[NSString defaultCStringEncoding]]];

这篇关于NSString替换unicode字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆