Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Objective-C文本编码问题解析HTTP上的HTML/明文_Html_Objective C_Macos_Http_Encoding - Fatal编程技术网

使用Objective-C文本编码问题解析HTTP上的HTML/明文

使用Objective-C文本编码问题解析HTTP上的HTML/明文,html,objective-c,macos,http,encoding,Html,Objective C,Macos,Http,Encoding,我正在使用NSURLConnection解析一些纯文本/HTML,如下所示: NSURLResponse *response; NSData *result = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; //I should find a better way to convert this string NSString *content

我正在使用NSURLConnection解析一些纯文本/HTML,如下所示:

NSURLResponse *response;
NSData *result = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
//I should find a better way to convert this string
NSString *content = [NSString stringWithCString:[result bytes]];
我尝试过使用stringWithCString和stringWithUTF8String,但对于像
';
这样的特殊字符,我仍然会遇到奇怪的HTML格式错误


我确信有一些非常明显的更好的方法来解码文本,但我对ObjC非常陌生,对于谷歌搜索的目的有点不知所措。

非常明显的答案是,要解析HTML,你需要一个HTML解析器。

如果有人来找我,我会提供我想要的