开发者

NSString encoding-name from WebDataSource?

开发者 https://www.devze.com 2023-02-19 22:25 出处:网络
I have a WebDataSource and I want to get pure HTML out of it. How can I do it? The way I did it so far is:

I have a WebDataSource and I want to get pure HTML out of it. How can I do it? The way I did it so far is:

get it's webArchive, and then get W开发者_如何转开发ebArchive's data. But when I try to store it in a string, I don't know the encoding name? What should I use? I used several and it gives me nil. How can I find it from the WebDataSource what encoding its using?

Thanks!


I'm not sure WebDataSource is really what you want for this. If you want to get the HTML, you should be using NSURLRequest, which will pull the HTML in as NSData. You can then encode it into a string with NSUTF8StringEncoding.

Are you familiar with NSURLRequest?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号