NSString encoding-name from WebDataSource?
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?
精彩评论