diff --git a/Frm_Main.cs b/Frm_Main.cs index ee2e865..b1cbf44 100644 --- a/Frm_Main.cs +++ b/Frm_Main.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Text; using System.Windows.Forms; using AliKeywordSearch; +using System.Web; namespace EnAliKeywordSearch { @@ -46,9 +47,10 @@ namespace EnAliKeywordSearch this.ResultView.Rows[index].Cells["排名"].Value = "正在查询第" + i + "页..."; Application.DoEvents(); if (enAli.Checked == true) - url = String.Format("http://www.alibaba.com/products/F0/{0}/{1}.html", key, i); + url = String.Format("http://www.alibaba.com/products/F0/{0}/{1}.html", HttpUtility.UrlEncode(key), i); else - url = String.Format("http://s.1688.com/selloffer/offer_search.htm?keywords={0}&beginPage={1}", key, i); + url = String.Format("http://s.1688.com/selloffer/offer_search.htm?keywords={0}&beginPage={1}", HttpUtility.UrlEncode(key), i); + string htmldoc = httpHelper.Get(url); if (string.IsNullOrEmpty(htmldoc)) { @@ -57,7 +59,7 @@ namespace EnAliKeywordSearch maybe = true; continue; } - if (htmldoc.Contains(cpy)) + if (htmldoc.Contains(HttpUtility.HtmlEncode(cpy))) { pageinfo = "第" + i + "页"; break;