彻底解决Html工具HtmlAgilityPack 中文乱码问题

作者:小鱼的互联网观察 发布时间:November 23, 2009 分类:互联网观察

对于HtmlAgilityPack,修改HtmlWeb.cs的如下方法(红色为修改代码):

        private HttpStatusCode Get(Uri uri, string method, string path, HtmlDocument doc)
        {
            string cachePath = null;
            HttpWebRequest req;
            bool oldFile = false;

            req = WebRequest.Create(uri) as HttpWebRequest;
            req.Method = method;

            _fromCache = false;
            _requestDuration = 0;
            int tc = Environment.TickCount;
            if (UsingCache)
            {
                cachePath = GetCachePath(req.RequestUri);
                if (File.Exists(cachePath))
                {
                    req.IfModifiedSince = File.GetLastAccessTime(cachePath);
                    oldFile = true;
                }
            }

阅读剩余部分...

  1. 页码:
网站地图 京ICP证030173号