{"id":85,"date":"2015-01-27T09:09:14","date_gmt":"2015-01-27T01:09:14","guid":{"rendered":"http:\/\/blog.qiaogen.com\/?p=85"},"modified":"2015-01-27T09:09:14","modified_gmt":"2015-01-27T01:09:14","slug":"%e8%a7%a3%e5%86%b3wget%e4%b8%8b%e8%bd%bd%e6%96%87%e4%bb%b6%e5%90%8d%e4%b9%b1%e7%a0%81%e7%9a%84%e4%b8%80%e4%ba%9b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.sangqiao.com\/blog\/archives\/85","title":{"rendered":"\u89e3\u51b3wget\u4e0b\u8f7d\u6587\u4ef6\u540d\u4e71\u7801\u7684\u4e00\u4e9b\u65b9\u6cd5"},"content":{"rendered":"<div>\n<p>\u8f6c\u8f7d\u672c\u7ad9\u6587\u7ae0\u8bf7\u6ce8\u660e\uff0c\u8f6c\u8f7d\u81ea: <a href=\"http:\/\/Jacky.Aiwaly.com\"> AIWALY\u535a\u5ba22008\u7248 <\/a> <a href=\"http:\/\/Jacky.Aiwaly.com\"> [http:\/\/Jacky.Aiwaly.com]<\/a><br \/>\n\u672c\u6587\u94fe\u63a5: <a href=\"http:\/\/jacky.aiwaly.com\/wp\/wget-lunma-question.html\"> http:\/\/jacky.aiwaly.com\/wp\/wget-lunma-question.html <\/a><\/p>\n<\/div>\n<p>\u5728<a title=\"\u67e5\u770b \u4e0b\u8f7d \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/%e4%b8%8b%e8%bd%bd\" target=\"_blank\">\u4e0b\u8f7d<\/a>\u7528apache\u6216\u8005nginx\u505a\u7684\u7d22\u5f15\u76ee\u5f55\u65f6\uff0c\u9047\u5230<a title=\"\u67e5\u770b \u6587\u4ef6\u540d \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/%e6%96%87%e4%bb%b6%e5%90%8d\" target=\"_blank\">\u6587\u4ef6\u540d<\/a><a title=\"\u67e5\u770b \u4e71\u7801 \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/%e4%b9%b1%e7%a0%81\" target=\"_blank\">\u4e71\u7801<\/a>\u95ee\u9898\u3002\u641c\u7d22\u4e86\u4e0d\u5c11\u8d44\u6599\uff0c\u5c1d\u8bd5\u4e86\u597d\u51e0\u79cd\u65b9\u6848\uff0c\u5927\u5bb6\u53ef\u4ee5\u7ed3\u5408\u4f7f\u7528\u3002<\/p>\n<p>\u4e00\u822c\u60c5\u51b5\u4e0b\u52a0\u4e0a\u2013restrict-file-names=nocontrol\u53c2\u6570\u5c31\u53ef\u4ee5\u7528\u4e86\u3002<\/p>\n<p>\u5176\u5b9e\u9664\u4e86\u4e0b\u9762\u65b9\u6cd5\u4e00\u548c\u65b9\u6cd5\u4e8c\u5916\uff0c\u8fd8\u6709\u4e00\u4e2a\u5927\u5bb6\u53ef\u4ee5\u81ea\u7531\u53d1\u6325\u7684\uff0c\u6211\u662f\u6ca1\u6709\u7814\u7a76\u900f\uff0c\u7f16\u7801\u5b9e\u5728\u592a\u8ba9\u81ea\u5df1\u5934\u75bc\u4e86\u3002<\/p>\n<p>\u6709\u4e00\u4e2a\u524d\u63d0\uff0c\u8981\u6ce8\u610f\u7d22\u5f15\u76ee\u5f55\u663e\u793a\u51fa\u6765\u7684\u662f\u4ec0\u4e48\u7f16\u7801\uff0c\u6bd4\u5982\u6709\u4e9b\u7f51\u7ad9\u662fUTF-8\uff08\u8fd9\u4e2a\u5e94\u8be5\u6bd4\u8f83\u6b63\u89c4\uff0c\u4e2d\u6587\u4e0d\u4f1a\u51fa\u73b0\u5f88\u5927\u9ebb\u70e6\uff0c\u53ef\u4ee5\u7528\u65b9\u6cd5\u4e8c\u641e\u5b9a\uff09\uff0c\u6709\u4e9b\u662fGBK\uff0c\u53ef\u80fd\u8ddf\u6587\u4ef6\u7684\u7f16\u7801\uff0c\u6216\u8005apache\u3001nginx\u7684\u8bbe\u7f6e\u6709\u5173\u5427\u3002<\/p>\n<p>1\u3001<a title=\"\u67e5\u770b \u4e0b\u8f7d \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/%e4%b8%8b%e8%bd%bd\" target=\"_blank\">\u4e0b\u8f7d<\/a>\u7684\u65f6\u5019\u4fdd\u5b58\u6210ascii\uff0c\u8ddf\u65b9\u6cd5\u4e09\u7c7b\u4f3c<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p5321\">\n<td>\n<pre>1<\/pre>\n<\/td>\n<td id=\"p532code1\">\n<pre>wget --restrict-file-names=ascii -m www.xxx.com\/<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>2\u3001\u7528\u4e00\u4e2a\u91cd\u547d\u540d\u8f6f\u4ef6\uff0c\u83f2\u83f2\u66f4\u540d\u5b9d\u8d1dRenamePro8.0\uff0c\u76f8\u5f53\u597d\u7528\u3002\u5728\u201c\u9ad8\u7ea7<a title=\"\u67e5\u770b \u6587\u4ef6\u540d \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/%e6%96%87%e4%bb%b6%e5%90%8d\" target=\"_blank\">\u6587\u4ef6\u540d<\/a>\u53d8\u201d\u66f4\u91cc\u9762\u6709\u4e00\u4e2a\u201c\u6587\u4ef6\u540d\u7f16\u7801\u4e0e\u89e3\u7801\u201d\uff0c\u201cANSI\u7f16\u7801URL\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6587\u5b57\u201d\uff0c\u5927\u5bb6\u53ef\u4ee5\u591a\u8bd5\u8bd5\u3002<br \/>\n<a href=\"http:\/\/filemarkets.com\/file\/moper\/69f8207d\/\">\u4e0b\u8f7d\uff1a RenamePro8.zip<\/a><\/p>\n<p>3\u3001\u5982\u679c\u4e0d\u884c\uff0c\u53ef\u4ee5\u7814\u7a76\u4e00\u4e0b<a title=\"\u67e5\u770b wget \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/wget\" target=\"_blank\">wget<\/a>\u7684\u4e00\u4e9b\u53c2\u6570\uff0c\u76f8\u5173\u7684\u6709\u4e24\u4e2a\u3002<br \/>\n\u2013local-encoding=ENC IRI (\u56fd\u9645\u5316\u8d44\u6e90\u6807\u8bc6\u7b26) \u4f7f\u7528 ENC \u4f5c\u4e3a\u672c\u5730\u7f16\u7801\u3002<br \/>\n\u2013remote-encoding=ENC \u4f7f\u7528 ENC \u4f5c\u4e3a\u9ed8\u8ba4\u8fdc\u7a0b\u7f16\u7801\u3002<\/p>\n<p>\u65b9\u6cd5\u4e00<br \/>\nmoper\uff1a\u8fd9\u79cd\u65b9\u6cd5\u662f\u628a\u6587\u4ef6\u540d\u8f6c\u6362\u6210ascii\uff0c\u52a0\u4e86\u4e00\u4e2a\u2013restrict-file-name=ascii\u53c2\u6570\uff0c\u7136\u540e\u518d\u7528python\u5199\u7684\u4e00\u6bb5\u7a0b \u5e8f\uff0c\u8f6c\u6362\u6210win\u80fd\u591f\u63a5\u53d7\u7684\u7f16\u7801\u3002\u5176\u5b9e\u6211\u4eec\u53ea\u9700\u52a0\u53e6\u4e00\u4e2a\u53c2\u6570\u2013restrict-file-names=nocontrol\uff0c\u5c31\u53ef\u4ee5\u4e86\u3002<br \/>\n\u5b8c\u6574\u547d\u4ee4\u4e3a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p5322\">\n<td>\n<pre>1<\/pre>\n<\/td>\n<td id=\"p532code2\">\n<pre>wget --restrict-file-names=nocontrol -m http:\/\/ebook.elain.org<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\uff08\u6211\u89e3\u91ca\u7684\u4e0d\u4e13\u4e1a\u8bf7\u770b\u6b63\u6587\uff0c\u53d1\u89c9\u7f16\u7801\u597d\u6df7\u4e71\u54ce\uff09<\/p>\n<p>\u300a\u4f7f\u7528 <a title=\"\u67e5\u770b wget \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/wget\" target=\"_blank\">wget<\/a> \u6574\u7ad9\u4e0b\u8f7d\u300b<br \/>\n\u8f6c\u81eahttp:\/\/blog.csdn.net\/kowity\/article\/details\/6899256<\/p>\n<p>\u6700\u8fd1\u53d1\u73b0\u4e00\u4e2a\u5f88\u597d\u7684\u7f51\u7ad9\uff1ahttp:\/\/ebook.elain.org\uff0c\u91cc\u9762\u6709\u5927\u91cf\u7684\u6280\u672f\u4e66\u7c4d\u3002\u4e8e\u662f\u60f3\u4f7f\u7528 <a title=\"\u67e5\u770b wget \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/wget\" target=\"_blank\">wget<\/a> \u628a\u6574\u4e2a\u7f51\u7ad9\u90fd\u4e0b\u8f7d\u4e0b\u6765\u3002\u4f46\u662f wget \u5bf9\u4e2d\u6587\u7684 url \u652f\u6301\u5f97\u4e0d\u591f\u597d\uff0c\u76f4\u63a5\u4f7f\u7528\uff1a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p5323\">\n<td>\n<pre>1<\/pre>\n<\/td>\n<td id=\"p532code3\">\n<pre>\u3000\u3000wget -m http:\/\/ebook.elain.org<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u4e0b\u8f7d\u7684\u8bdd\uff0c\u4e2d\u6587\u6587\u4ef6\u540d\u5c31\u4f1a<a title=\"\u67e5\u770b \u4e71\u7801 \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/%e4%b9%b1%e7%a0%81\" target=\"_blank\">\u4e71\u7801<\/a>\uff0c\u6bd4\u5982\u201c2010\u67b6\u6784\u5e08\u5927\u4f1aPPT\u201d\u5c31\u53d8\u6210\u4e86\u201c2010\u93cb\u8235\u702f\u752f\u581d\u3047\u6d7c\u6b45PT\u201d\u3002<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p5324\">\n<td>\n<pre>1<\/pre>\n<\/td>\n<td id=\"p532code4\">\n<pre>\u3000\u3000wget --restrict-file-name=ascii -m http:\/\/ebook.elain.org<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u4e0b\u8f7d\u7684\u8bdd\uff0c\u4e2d\u6587\u6587\u4ef6\u540d\u4f1a\u7f16\u7801\u6210URL\u5f62\u5f0f\uff0c\u6bd4\u5982\u6bd4\u5982\u201c2010\u67b6\u6784\u5e08\u5927\u4f1aPPT\u201d\u5c31\u53d8\u6210\u4e86\u201c2010%E6%9E%B6%E6%9E%84%E5 %B8%88%E5%A4%A7%E4%BC%9APPT\u201d\u3002\u4e3b\u8981\u662f\u56e0\u4e3a\u5728\u7f51\u9875\u4e0a\uff0c\u4e2d\u6587 URL\u4f1a\u4ee5 UTF-8 \u6765\u7f16\u7801\uff0c\u800c Windows \u5b58\u50a8\u6587\u4ef6\u540d\u662f\u7528GBK\u7f16\u7801\u3002\u4e5f\u5c31\u662f\u8bf4\u201c2010\u93cb\u8235\u702f\u752f\u581d\u3047\u6d7c\u6b45PT\u201d\u5b9e\u9645\u4e0a\u662f\u4ee5 GBK \u7f16\u7801\u6765\u663e\u793a\u7684 UTF-8 \u7f16\u7801\u7684\u6587\u4ef6\u540d\u3002\u8fd9\u6837\u6211\u4eec\u53ea\u8981\u7528 Python \u5199\u4e2a\u7f16\u7801\u8f6c\u6362\u5668\u5c31\u53ef\u4ee5\u4e86\u3002\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p5325\">\n<td>\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\n28\r\n29\r\n30\r\n31\r\n32\r\n33\r\n34\r\n35\r\n36\r\n37\r\n38\r\n39\r\n40\r\n41\r\n42\r\n43\r\n44\r\n45\r\n46\r\n47\r\n48\r\n49\r\n50\r\n51\r\n52\r\n53\r\n54\r\n55\r\n56\r\n57\r\n58\r\n59\r\n60\r\n61\r\n62\r\n63\r\n64\r\n65\r\n66\r\n67\r\n68\r\n69\r\n70\r\n71\r\n72\r\n73\r\n74\r\n75\r\n76\r\n77\r\n78\r\n79\r\n80\r\n81<\/pre>\n<\/td>\n<td id=\"p532code5\">\n<pre>import os, urllib, sys, getopt\r\n\r\nclass Renamer:\r\n\r\n    input_encoding = \"\"\r\n    output_encoding = \"\"\r\n    path = \"\"\r\n    is_url = False\r\n\r\n    def __init__(self, input, output, path, is_url):\r\n        self.input_encoding = input\r\n        self.output_encoding = output\r\n        self.path = path\r\n        self.is_url = is_url\r\n\r\n    def start(self):\r\n        self.rename_dir(self.path)\r\n\r\n    def rename(self, root, path):\r\n        try:\r\n            if self.is_url:\r\n                new = urllib.unquote(path).decode(self.input_encoding).encode(self.output_encoding)\r\n            else:\r\n                new = path.decode(self.input_encoding).encode(self.output_encoding)\r\n            os.rename(os.path.join(root, path), os.path.join(root, new))\r\n        except:\r\n            pass\r\n\r\n    def rename_dir(self, path):\r\n        for root, dirs, files in os.walk(path):\r\n            for f in files:\r\n                self.rename(root, f)\r\n\r\n            if dirs == []:\r\n                for f in files:\r\n                    self.rename(root, f)\r\n            else:\r\n                for d in dirs:\r\n                    self.rename_dir(os.path.join(root, d))\r\n                    self.rename(root, d)\r\ndef usage():\r\n    print '''This program can change encode of files or directories.\r\n    Usage:   rename.exe [OPTION]...\r\n    Options:\r\n        -h, --help                  this document.\r\n        -i, --input-encoding=ENC    set original encoding, default is UTF-8.\r\n        -o, --output-encoding=ENC   set output encoding, default is GBK.\r\n        -p, --path=PATH             choose the path which to process.\r\n        -u, --is-url                whether as a URL\r\n    '''\r\n\r\ndef main(argv):\r\n    input_encoding = \"utf-8\"\r\n    output_encoding = \"gbk\"\r\n    path = \"\"\r\n    is_url = True\r\n\r\n    try:\r\n        opts, args = getopt.getopt(argv, \"hi:o:p:u\", [\"help\", \"input-encoding=\", \"output-encoding=\", \"path=\", \"is-url\"])\r\n    except getopt.GetoptError:\r\n        usage()\r\n        sys.exit(2)\r\n    for opt, arg in opts:\r\n        if opt in (\"-h\", \"--help\"):\r\n            usage()\r\n            sys.exit()\r\n        elif opt in (\"-i\", \"--input-encoding\"):\r\n            input_encoding = arg\r\n        elif opt in (\"-o\", \"--output-encoding\"):\r\n            output_encoding = arg\r\n        elif opt in (\"-p\", \"--path\"):\r\n            path = arg\r\n        elif opt in (\"-u\", \"--is-url\"):\r\n            is_url = True\r\n\r\n    rn = Renamer(input_encoding, output_encoding, path, is_url)\r\n    rn.start()\r\n\r\nif __name__ == '__main__':\r\n    main(sys.argv[1:])<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u5982\u679c wget \u662f\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u884c\u6765\u4e0b\u8f7d\uff1a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p5326\">\n<td>\n<pre>1<\/pre>\n<\/td>\n<td id=\"p532code6\">\n<pre>\u3000\u3000wget --restrict-file-name=ascii -m http:\/\/ebook.elain.org<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u90a3\u4e48\u4e0b\u8f7d\u4e0b\u6765\u7684\u6587\u4ef6\u662f\u201c2010%E6%9E%B6%E6%9E%84%E5%B8%88%E5%A4%A7%E4%BC%9APPT\u201d\u5f62\u5f0f\uff0c\u8fd0\u884c\u811a\u672c\u65f6\u5c31\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p5327\">\n<td>\n<pre>1<\/pre>\n<\/td>\n<td id=\"p532code7\">\n<pre>\u3000\u3000rename.py -i utf-8 -o gbk -p R:\\ebook.elain.org -u<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u65b9\u6cd5\u4e8c<br \/>\n\u6539wget\u6e90\u4ee3\u7801<\/p>\n<p>moper\uff1a\u4e0d\u63a8\u8350\u8fd9\u79cd\u65b9\u6cd5\uff0c\u56e0\u4e3a\u6bd4\u8f83\u9ebb\u70e6\uff0c\u6211\u4e5f\u6ca1\u6709\u6d4b\u8bd5\uff0c\u53ef\u80fd\u8fd9\u79cd\u6548\u679c\u4f1a\u597d\u4e00\u4e9b\u5427\u3002<\/p>\n<p>\u6587\u7ae0\u4e00\u300awget\u4e2d\u6587<a title=\"\u67e5\u770b \u4e71\u7801 \u4e2d\u7684\u5168\u90e8\u6587\u7ae0\" href=\"http:\/\/moper.me\/tag\/%e4%b9%b1%e7%a0%81\" target=\"_blank\">\u4e71\u7801<\/a>\u89e3\u51b3\u65b9\u6848\u300b<\/p>\n<p>\u7528wget\u4e0b\u8f7d\u7f51\u9875\u65f6\uff0c\u82e5\u6587\u4ef6\u540d\u542b\u6709\u975eASCII\u5b57\u7b26\u6216\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\uff0c\u5c31\u4f1a\u51fa\u73b0\u6240\u8c13\u7684\u4e71\u7801\u3002\u82e5\u60f3\u89e3\u51b3\u4e2d\u6587\u4e71\u7801\u7684\u95ee\u9898\uff0c\u53ef\u4ee5\u4fee\u6539wget\u7684\u6e90\u4ee3\u7801\u3002<br \/>\n\u5bf9URL\u5b57\u7b26\u4e32\u8fdb\u884c\u7f16\u7801\u7684\u6e90\u4ee3\u7801\u6587\u4ef6\u662furl.c\u3002\u5176\u4e2d\uff0curl_file_name()\u7684\u529f\u80fd\u662f\u6839\u636eURL\u5224\u65ad\u5e94\u8be5\u4ee5\u4ec0\u4e48\u6587\u4ef6\u540d\u4fdd\u5b58\u6587\u4ef6\u3002\u800c\u8be5\u51fd\u6570\u53c8\u8c03 \u7528\u4e86append_uri_pathel()\uff0c\u8be5\u51fd\u6570\u8c03\u7528\u4e86FILE_CHAR_TEST()\u5b8f\uff0c\u5b83\u7528\u4e8e\u5224\u65adURL\u4e2d\u7684\u5b57\u7b26\u662f\u4e0d\u662f\u7279\u6b8a\u5b57\u7b26\uff08\u4e5f\u5c31\u662f\u9700\u8981\u8fdb \u884cURL\u7f16\u7801\u7684\u5b57\u7b26\u3002\u5f53\u7136\uff0c\u5305\u62ec\u4e2d\u6587\uff09\u3002\u95ee\u9898\u5c31\u51fa\u5728\u8fd9\u4e2a\u5b8f\u8eab\u4e0a\u4e86\u3002\u4e3a\u4e86\u4e0d\u5bf9\u4e2d\u6587\u8f6c\u4e49\uff0c\u9700\u8981\u5c06\u4e2d\u6587\u5b57\u7b26\u5f53\u4f5c\u666e\u901a\u5b57\u7b26\u5bf9\u5f85\u3002\u5c06\u5982\u4e0b\u6240\u793a\u7684 FILE_CHAR_TEST()\u5b8f\uff1a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p5328\">\n<td>\n<pre>1\r\n2\r\n3<\/pre>\n<\/td>\n<td id=\"p532code8\">\n<pre>#define FILE_CHAR_TEST(c, mask) \\\r\n    ((opt.restrict_files_nonascii &amp;&amp; !c_isascii ((unsigned char)(c))) || \\\r\n    (filechr_table[(unsigned char)(c)] &amp; (mask)))<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u4fee\u6539\u4e3a\uff1a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p5329\">\n<td>\n<pre>1\r\n2\r\n3\r\n4<\/pre>\n<\/td>\n<td id=\"p532code9\">\n<pre>#define FILE_CHAR_TEST(c, mask) \\\r\n(((opt.restrict_files_nonascii &amp;&amp; !c_isascii ((unsigned char)(c))) || \\\r\n(filechr_table[(unsigned char)(c)] &amp; (mask))) \\\r\n&amp;&amp; !((c|0x0fffffff) == 0xffffffff)) \/* \u6392\u9664\u4e2d\u6587 *\/<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u6587\u7ae0\u4e8c\u300a\u89e3\u6c7awget\u4e2d\u6587\u4e82\u78bc\u554f\u984c\u7684\u975e\u5b8c\u5584\u65b9\u6848\u300b<\/p>\n<p>1. \u51fa\u73fe\u4e82\u78bc\u7684\u539f\u56e0<\/p>\n<p>http\u8acb\u6c42\u7684\u6d41\u7a0b\u5982\u4e0b\uff1a<br \/>\n(1) \u700f\u89bd\u5668\u6309URL\u7de8\u78bc\u898f\u5247\u5c07URL\uff08\u5305\u62ecpost\u6216get\u63d0\u4ea4\u7684\u90a3\u4e00\u90e8\u5206\uff09\u5b57\u7b26\u4e32\u7de8\u78bc\u4e4b\u5f8c\u767c\u9001\u7d66\u670d\u52d9\u5668\uff1b<br \/>\n(2) \u670d\u52d9\u5668\u5c07\u6240\u6536\u5230\u7684\u5b57\u7b26\u4e32\u8f49\u63db\u70baunicode\u7de8\u78bc\uff0c\u8655\u7406\u5b8c\u700f\u89bd\u5668\u7684\u8acb\u6c42\u5f8c\u518d\u628a\u5b83\u767c\u9001\u7d66\u700f\u89bd\u5668\uff1b<br \/>\n(3) \u700f\u89bd\u5668\u6309\u6307\u5b9a\u7684\u7de8\u78bc\u986f\u793a\u7db2\u9801\u3002<br \/>\n\u5728\u4e0d\u540c\u7684\u5b57\u7b26\u7de8\u78bc\u683c\u5f0f\u4e0b\uff0c\u700f\u89bd\u5668\u5c0d\u5305\u542b\u8af8\u5982\u4e2d\u6587\u4e4b\u985e\u7684\u975eACSII\u5b57\u7b26\u7684URL\u5b57\u7b26\u4e32\u7684\u89e3\u6790\u7d50\u679c\u662f\u4e0d\u4e00\u6a23\u7684\u3002\u5f9e\u800c\uff0cURL\u7de8\u78bc\u5c0d\u8c61\u5c31\u4e0d\u4e00\u6a23\u4e86\u3002 wget\u4e0b\u8f09\u7db2\u9801\u6587\u4ef6\u6642\uff0c\u5be6\u8cea\u4e0a\u662f\u4e00\u500b\u700f\u89bd\u5668\u3002\u5b83\u540c\u6a23\u6703\u5c0d\u6240\u63d0\u4ea4\u7684URL\u5b57\u7b26\u4e32\u6309URL\u7de8\u78bc\u898f\u5247\u7de8\u78bc\u3002\u56e0\u6b64\uff0c\u6240\u4e0b\u8f09\u7684\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u5c31\u662f\u7d93\u904e\u7de8\u78bc\uff08\u5148\u662f\u6309 URL\u898f\u5247\u7de8\u78bc\uff0c\u63a5\u8457\u662funicode\u7de8\u78bc\uff0c\u6700\u5f8c\u662funicode\u5230\u700f\u89bd\u5668\u7aef\u6240\u8a2d\u5b9a\u7684\u7de8\u78bc\uff09\u4e4b\u5f8c\u7684\u5b57\u7b26\u4e32\u3002\u5982\u679c\u700f\u89bd\u5668\u7aef\u63a1\u7528\u7684\u662funicode\u7de8\u78bc\uff0c\u5247\u7d50 \u679c\u662f\u4e00\u4e32\u7531\u2019%\u2019\u3001\u6578\u5b57\u548c\u5b57\u6bcd\u7d44\u6210\u7684\u5b57\u7b26\u4e32\uff1b\u5426\u5247\uff0c\u5c07unicode\u7de8\u78bc\u683c\u5f0f\u7684URL\u5b57\u7b26\u4e32\u89e3\u6790\u70ba\u700f\u89bd\u5668\u7aef\u7684\u7de8\u78bc\u683c\u5f0f\uff0c\u9019\u53ef\u80fd\u6703\u7522\u751f\u975eACSII\u5b57\u7b26\u3002\u6211 \u5011\u6240\u8aaa\u7684\u4e82\u78bc\uff0c\u5305\u62ec\u9019\u5169\u7a2e\u60c5\u6cc1\u3002\u4e5f\u5c31\u662f\u8aaa\uff0c\u8ddf\u539f\u4f86\u7684\u6587\u4ef6\u540d\u4e0d\u4e00\u6a23\uff0c\u6211\u5011\u5c31\u7ba1\u5b83\u51fa\u73fe\u4e82\u78bc\u3002<\/p>\n<p>2. \u89e3\u6c7a\u65b9\u6848<\/p>\n<p>\u7531\u4e8e\u4e0a\u8ff0\u539f\u56e0\uff0c\u6211\u5011\u6709\u5fc5\u8981\u4fee\u6539wget\u7684\u6e90\u4ee3\u78bc\u3002\u5c0dURL\u5b57\u7b26\u4e32\u9032\u884c\u7de8\u78bc\u7684\u6e90\u4ee3\u78bc\u6587\u4ef6\u662furl.c\u3002\u5176\u4e2d\uff0curl_file_name()\u7684\u529f \u80fd\u662f\u6839\u64daURL\u5224\u65b7\u61c9\u8a72\u4ee5\u4ec0\u3000\u6587\u4ef6\u540d\u4fdd\u5b58\u6587\u4ef6\u3002\u800c\u8a72\u51fd\u6578\u53c8\u8abf\u7528\u4e86append_uri_pathel()\uff0c\u8a72\u51fd\u6578\u8abf\u7528\u4e86FILE_CHAR_TEST() \u5b8f\uff0c\u5b83\u7528\u4e8e\u5224\u65b7URL\u4e2d\u7684\u5b57\u7b26\u662f\u4e0d\u662f\u7279\u6b8a\u5b57\u7b26\uff08\u4e5f\u5c31\u662f\u9700\u8981\u9032\u884cURL\u7de8\u78bc\u7684\u5b57\u7b26\u3002\u7576\u7136\uff0c\u5305\u62ec\u4e2d\u6587\uff09\u3002\u554f\u984c\u5c31\u51fa\u5728\u9019\u500b\u5b8f\u8eab\u4e0a\u4e86\u3002\u70ba\u4e86\u4e0d\u5c0d\u4e2d\u6587\u8f49\u7fa9\uff0c\u9700\u8981\u5c07\u4e2d \u6587\u5b57\u7b26\u7576\u4f5c\u666e\u901a\u5b57\u7b26\u5c0d\u5f85\u3002\u5c07\u5982\u4e0b\u6240\u793a\u7684FILE_CHAR_TEST()\u5b8f\uff1a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p53210\">\n<td>\n<pre>1\r\n2\r\n3<\/pre>\n<\/td>\n<td id=\"p532code10\">\n<pre>\u3000\u3000#define FILE_CHAR_TEST(c, mask) \\\r\n\u3000\u3000\u3000\u3000((opt.restrict_files_nonascii &amp;&amp; !c_isascii ((unsigned char)(c))) || \\\r\n\u3000\u3000\u3000\u3000(filechr_table[(unsigned char)(c)] &amp; (mask)))<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u4fee\u6539\u70ba\uff1a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p53211\">\n<td>\n<pre>1\r\n2\r\n3\r\n4<\/pre>\n<\/td>\n<td id=\"p532code11\">\n<pre>\u3000\u3000#define FILE_CHAR_TEST(c, mask) \\\r\n\u3000\u3000\u3000\u3000(((opt.restrict_files_nonascii &amp;&amp; !c_isascii ((unsigned char)(c))) || \\\r\n\u3000\u3000\u3000\u3000(filechr_table[(unsigned char)(c)] &amp; (mask))) \\\r\n\u3000\u3000\u3000\u3000&amp;&amp; !((c|0x0fffffff) == 0xffffffff)) \/* \u6392\u9664\u4e2d\u6587 *\/<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u53e6\u5916\uff0c\u5982\u679c\u4f7f\u7528unicode\u7de8\u78bc\u65b9\u6848\u7684\u8a71\uff0c\u5c31\u4e0d\u6703\u51fa\u73fe\u4e0a\u8ff0\u7b2c\u4e8c\u7a2e\u4e82\u78bc\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u5c07\u700f\u89bd\u5668\u7aef\u7684\u5b57\u7b26\u7de8\u78bc\u74b0\u5883\u8a2d\u7f6e\u70baunicode\u3002\u9019\u88e1\uff0c\u9078\u64c7 UTF-8\u7de8\u78bc\u65b9\u6848\uff08UCS Transformation Format\uff09\u3002\u65b9\u6cd5\u662f\u5728main.c\u7684i18n_initialize\u6700\u5f8c\u52a0\u4e0a\uff1a<\/p>\n<div><sup><a title=\"WP-CodeBox HowTo?\" href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/#examples\" target=\"_blank\">?<\/a><\/sup>Download <a href=\"http:\/\/moper.me\/wp-content\/plugins\/wp-codebox\/wp-codebox.php?p=532&amp;download=download.txt\">download.txt<\/a><\/div>\n<div>\n<table>\n<tbody>\n<tr id=\"p53212\">\n<td>\n<pre>1<\/pre>\n<\/td>\n<td id=\"p532code12\">\n<pre>'setlocale(LC_CTYPE, \"zh_CN.UTF-8\");'<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u3002<br \/>\n\u9019\u4e0d\u662f\u4e00\u500b\u5f88\u597d\u7684\u89e3\u6c7a\u65b9\u6848\u3002\u53e6\u5916\uff0c\u5b83\u6c92\u8fa6\u6cd5\u89e3\u6c7a\u5176\u4ed6\u8a9e\u8a00\u7684\u4e82\u78bc\u554f\u984c\u3002\u7576\u7136\uff0c\u53ef\u4ee5\u5c07url_file_name()\u4e2d\u7684URL\u7de8\u78bc\u90e8\u4efd\u7d71\u7d71\u62ff\u6389\u3002\u9019\u6a23\u505a \u7684\u7d50\u679c\u662f\uff0c\u4e0d\u51fa\u73fe\u4e82\u78bc\uff0c\u73fe\u6642\u4ea6\u9055\u80cc\u4e86URL\u7de8\u78bc\u7684\u521d\u8877\uff0d\uff0d\u5b89\u5168\u3002\u4e0d\u904e\u6211\u9084\u6c92\u60f3\u5230\u66f4\u7c21\u55ae\u7684\u65b9\u6848\u3002\u9019\u662f\u4e00\u7a2e\u66ab\u884c\u65b9\u6848\u3002\u5e0c\u671b\u5b98\u65b9\u7684\u89e3\u6c7a\u65b9\u6848\u7684\u51fa\u73fe\u4e0d\u6703\u8def\u6f2b\u6f2b\u5176\u4fee \u9060\u516e\u3002\u3002\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\u672c\u7ad9\u6587\u7ae0\u8bf7\u6ce8\u660e\uff0c\u8f6c\u8f7d\u81ea: AIWALY\u535a\u5ba22008\u7248 [http:\/\/Jacky.Aiwaly.com]  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/posts\/85"}],"collection":[{"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":1,"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":86,"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/posts\/85\/revisions\/86"}],"wp:attachment":[{"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sangqiao.com\/blog\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}