{"id":67742,"date":"2017-02-22T02:04:31","date_gmt":"2017-02-21T18:04:31","guid":{"rendered":"http:\/\/www.xiaoyebailong.com\/?p=67742"},"modified":"2017-02-26T02:08:48","modified_gmt":"2017-02-25T18:08:48","slug":"asp%e4%b8%ad%e7%9a%84urlencode%e7%9a%84%e8%a7%a3%e7%a0%81%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2017\/02\/22\/67742.htm","title":{"rendered":"ASP\u4e2d\u7684URLEncode\u7684\u89e3\u7801\u51fd\u6570"},"content":{"rendered":"<p>\u5728\u505aajax\u4e2d\u7684post\u65f6\uff0c\u53d1\u73b0\u5728\u670d\u52a1\u5668\u7aef\u53d6\u5f97\u6570\u636e\u65f6\u603b\u662f\u4e71\u7801\uff0c\u7f51\u4e0a\u770b\u4e86\u4e9b\u89e3\u51b3\u65b9\u6cd5\u4e5f\u641e\u4e0d\u5b9a\uff0c\u6211post\u8fc7\u53bb\u65f6\u662fxml\u5f62\u5f0f\uff0c\u7531\u4e8e\u4e71\u7801\u670d\u52a1\u5668\u7aefxml\u4e5f\u89e3\u6790\u4e0d\u4e86\u6216\u51fa\u9519\u3002\u4e8e\u662f\u5728post\u524d\u5148\u628a\u5b83\u7f16\u7801\uff0c\u5230\u670d\u52a1\u5668\u7aef\u518d\u89e3\u7801\uff0c\u8fd9\u6837\u95ee\u9898\u89e3\u51b3\u4e86\uff0c\u4f46\u662f\u8981\u662f\u6570\u636e\u5f88\u5927\u65f6\u4f30\u8ba1\u4f1a\u5f88\u5f71\u54cd\u901f\u5ea6\u3002<\/p>\n<p>\u867d\u7136ASP\u4e2d\u7684request\u4f1a\u81ea\u52a8\u89e3\u7801\u7ecf\u8fc7url\u7f16\u7801\u7684\u5b57\u7b26\u4e32\uff0c\u4f46\u662fRequest.BinaryRead(Request.TotalBytes)\u53d6\u5f97post\u6570\u636e\u65f6\u5374\u4e0d\u4f1a\u89e3\u7801\uff0c\u6240\u4ee5\u8981\u8fdb\u884c\u89e3\u7801<br \/>\n\u4e0b\u9762\u662f\u6211\u627e\u5230\u7684\u4e00\u4e2aASP\u4e2dserver.urlencode\u51fd\u6570\u7684\u89e3\u7801\u51fd\u6570<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24\r\n25\r\n26\r\n27\r\n<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"asp\">Function URLDecode(enStr)\r\n  dim deStr,strSpecial\r\n  dim c,i,v\r\n    deStr=\"\"\r\n    strSpecial=\"!\"\"#$%&amp;'()*+,.-_\/:;&lt; =&gt;?@[\/]^`{|}~%\"\r\n    for i=1 to len(enStr)\r\n      c=Mid(enStr,i,1)\r\n      if c=\"%\" then\r\n        v=eval(\"&amp;h\"+Mid(enStr,i+1,2))\r\n        if inStr(strSpecial,chr(v))&gt;0 then\r\n          deStr=deStr&amp;chr(v)\r\n          i=i+2\r\n        else\r\n          v=eval(\"&amp;h\"+ Mid(enStr,i+1,2) + Mid(enStr,i+4,2))\r\n          deStr=deStr &amp; chr(v)\r\n          i=i+5\r\n        end if\r\n      else\r\n        if c=\"+\" then\r\n          deStr=deStr&amp;\" \"\r\n        else\r\n          deStr=deStr&amp;c\r\n        end if\r\n      end if\r\n    next\r\n    URLDecode=deStr\r\nEnd function<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u518d\u9644\u4e00\u4e2a\u7f16\u7801\u51fd\u6570\uff0c\u8fd9\u4e2a\u4e0eserver.urlencode\u4e0d\u4e00\u6837\u4e4b\u5904\u662f\uff1aserver.urlencode\u4f1a\u5c06html\u6216xml\u7b49\u6807\u7b7e\uff0c\u5982<br \/>\n\u4e5f\u4f1a\u8fdb\u884c\u7f16\u7801\uff0c\u800c\u4e0b\u9762\u8fd9\u4e2a\u51fd\u6570\u4e0d\u4f1a\u3002\u6211\u662f\u7528\u4e0b\u9762\u7684\u8fdb\u884c\u7f16\u7801\uff0c\u518d\u89e3\u7801\uff0c\u56e0\u4e3a\u6211\u7528post\u65f6\u7528xml\u7684\u3002<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"asp\">  private Function URLEncoding(vstrIn) \r\n    strReturn = \"\" \r\n    For i = 1 To Len(vstrIn) \r\n    ThisChr = Mid(vStrIn,i,1) \r\n    If Abs(Asc(ThisChr)) &lt; &amp;HFF Then \r\n    strReturn = strReturn &amp; ThisChr \r\n    Else \r\n    innerCode = Asc(ThisChr) \r\n    If innerCode &lt; 0 Then \r\n    innerCode = innerCode + &amp;H10000 \r\n    End If \r\n    Hight8 = (innerCode And &amp;HFF00)\/ &amp;HFF \r\n    Low8 = innerCode And &amp;HFF \r\n    strReturn = strReturn &amp; \"%\" &amp; Hex(Hight8) &amp; \"%\" &amp; Hex(Low8) \r\n    End If \r\n    Next \r\n    URLEncoding = strReturn \r\n  End Function<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u505aajax\u4e2d\u7684post\u65f6\uff0c\u53d1\u73b0\u5728\u670d\u52a1\u5668\u7aef\u53d6\u5f97\u6570\u636e\u65f6\u603b\u662f\u4e71\u7801\uff0c\u7f51\u4e0a\u770b\u4e86\u4e9b\u89e3\u51b3\u65b9\u6cd5\u4e5f\u641e\u4e0d\u5b9a\uff0c\u6211post\u8fc7\u53bb\u65f6\u662fxml\u5f62\u5f0f\uff0c\u7531\u4e8e\u4e71\u7801\u670d\u52a1\u5668\u7aefxml\u4e5f\u89e3\u6790\u4e0d\u4e86\u6216\u51fa\u9519\u3002\u4e8e\u662f\u5728post\u524d\u5148\u628a\u5b83\u7f16\u7801\uff0c\u5230\u670d\u52a1\u5668\u7aef\u518d\u89e3\u7801\uff0c\u8fd9\u6837\u95ee\u9898\u89e3\u51b3\u4e86\uff0c\u4f46\u662f\u8981\u662f\u6570\u636e\u5f88\u5927\u65f6&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[12,258,259],"topic":[],"class_list":["post-67742","post","type-post","status-publish","format-standard","hentry","category-htmlcss","category-technology","tag-asp","tag-urlencode","tag-259"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/67742","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=67742"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/67742\/revisions"}],"predecessor-version":[{"id":67743,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/67742\/revisions\/67743"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=67742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=67742"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=67742"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=67742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}