Reading html with accented characters from a URL on iPhone
I'm having trouble extracting the html from a website which contains accented characters. Specifically, there are French characters on the site. Current开发者_开发问答ly I'm using:
NSString* html= [NSString stringWithContentsOfURL: [NSURL URLWithString: url] usedEncoding: &enc error:&error];
to get html from a URL. It works perfectly fine for any sites which are all English, but with a mostly English site with French characters it returns nothing. I've tried a few different types of encoding, but none have worked for me. Any suggestions?
Thanks.
I had a similar problem and was a matter of encoding. So check with your browser which one is used in your page (I use firefox view > character encoding) and then use it in the method.
精彩评论