Html agility pack parsing Website encoding iso-8859-1 REALLY ANNOYING

孤街浪徒 提交于 2019-12-11 04:23:39

问题


I have been parsing this website for my windows phone app using Html agility pack;

First I download it using webclient class and then give the result for HtmlDocument.

There was some problems with iso-8859-1 encoding but htmlentity.DeEntitize solved problems with letters Ö ä showing as &Ouml and &auml...

But the document still has some scandinavian characters (äö) in some random encoding (which are showed as: �).

Those letters show perfectly using chrome.

site is: http://reittiopas.tampere.fi/mobile/fi/


回答1:


Windows Phone only support a small set of encodings, and iso-8859-1 is not one of them!

To solve this, just create the encoding handler with Silverlight Encoding Generator, convert the text, and then use HTML Agility Pack as you are now!



来源:https://stackoverflow.com/questions/10273083/html-agility-pack-parsing-website-encoding-iso-8859-1-really-annoying

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!