From 9fc43f81a5a5721134818e2301234c5b65a1784a Mon Sep 17 00:00:00 2001 From: j502647092 Date: Mon, 27 Jul 2015 16:56:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E7=A0=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E5=85=AC=E5=8F=B8=E5=90=8D=E7=A7=B0Html=E7=BC=96?= =?UTF-8?q?=E7=A0=81=20=E5=85=B3=E9=94=AE=E8=AF=8DURL=E7=BC=96=E7=A0=81...?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frm_Main.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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;