从Web内容.xml文件到NSString的UTF8 [英] UTF8 from web content .xml file to NSString
本文介绍了从Web内容.xml文件到NSString的UTF8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我找不到将某些UTF8编码转换为NSString的方法.
I can't find a way to convert some UTF8 encoding into NSString.
我从URL获取一些数据,它是一个.xml文件,其内容如下:
I get some data from a URL, it's a .xml file and here is their content:
<?xml version="1.0" encoding="UTF-8"?>
<person>
<name>Jim Fernández</name>
<phone>555-1234</phone>
</person>
如何转换& #225;变成á吗?
How can I convert the & #225; into a á ?
一些无效的代码:
NSString* newStr = [[NSString alloc] initWithData:[NSData dataWithContentsOfURL:URL] encoding:NSUTF8StringEncoding];
我正在使用 TBXML 库
推荐答案
Finally I'm using the NSString+XMLEntities from Michael Waterfall to decode .xml
这篇关于从Web内容.xml文件到NSString的UTF8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文