开发者

Reading html with accented characters from a URL on iPhone

开发者 https://www.devze.com 2023-01-02 10:39 出处:网络
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:

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.

0

精彩评论

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