NSXMLParser encoding error

≯℡__Kan透↙ 提交于 2019-12-12 04:04:06

问题


I'm programming an application using latin characters. Here are the lines I use to get data by XML parsing.

NSURL *url = [NSURL URLWithString:urlString]; // urlString : param of the function
NSData *data = [NSData dataWithContentsOfURL:url];
parser = [[NSXMLParser alloc] initWithData:data];

But for example, œ or ' are replaced by ¿. So what should I do ?

The encoding of my xml file :

<?xml version="1.0" encoding="ISO8859-1"?>

Thanks for your advices


回答1:


You can try this:

œ ==> &oelig; and for ' ==> &apos;

if you need more characters use this:

http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references



来源:https://stackoverflow.com/questions/10777859/nsxmlparser-encoding-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!