Skip to content

Instantly share code, notes, and snippets.

@chichunchen
Created January 26, 2015 18:40
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save chichunchen/8f39ac17684781022391 to your computer and use it in GitHub Desktop.
Save chichunchen/8f39ac17684781022391 to your computer and use it in GitHub Desktop.
用 wget 从服务器下载文件经常遇到中文文件名变成乱码的问题。
reference: http://m13253.blogspot.tw/2013/04/solve-corrupted-chinese-filename-for-wget.html
其实不必要像那样修改源代码,wget 的 man 页面里就有解决方法。
正解是参数 --restrict-file-names=nocontrol
Update: +筱百合 提供了他的 ~/.wgetrc 文件,方便大家借鉴:
# 不要乱转义中文
--restrict-file-names=nocontrol
# 使用重定向后的文件名
--trust-server-names=on
--content-disposition=on
@geekyouth
Copy link

我这边win10 cmd 窗口直接提示404 无法找到,试过了各种方式无效

wget -c -r -np -k -L -p -x -nc -N --restrict-file-names=nocontrol http://xxxxxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment