How to download link with unicode using wget?
Sometimes a link has unicode characters in it, such as http://www.example.com/файл.zip
If you point your browser to it, it will properly prompt you to download the file as файл.zip. But if you try to do it with wget
, the file comes with a mix of ?, percent encoding (like %D0%BB) and the (invalid encoding)
string after the filename.
What parameters can I add to wget, or any other command line tricks, so that it behaves as Chrome and Firefox and saves the file exactly as specified in the rendered link - in this case, as файл.zip?
The solution should work without having to explicitly write it in the command, so an explicit wget -O файл.zip http://www.example.com/файл.zip
is not a good solution.
I realize that as soon as you run wget http://www.example.com/файл.zip
it tries to retrieve http://www.example.com/%D1%84%D0%B0%D0%B9%D0%BB.zip, that is, it converts the link to percent encoding, which may be the reason why it saves it doesn't render the filename "properly".
I posted a somewhat related question here, whose answer may or may not be of help to this one.
wget unicode
add a comment |
Sometimes a link has unicode characters in it, such as http://www.example.com/файл.zip
If you point your browser to it, it will properly prompt you to download the file as файл.zip. But if you try to do it with wget
, the file comes with a mix of ?, percent encoding (like %D0%BB) and the (invalid encoding)
string after the filename.
What parameters can I add to wget, or any other command line tricks, so that it behaves as Chrome and Firefox and saves the file exactly as specified in the rendered link - in this case, as файл.zip?
The solution should work without having to explicitly write it in the command, so an explicit wget -O файл.zip http://www.example.com/файл.zip
is not a good solution.
I realize that as soon as you run wget http://www.example.com/файл.zip
it tries to retrieve http://www.example.com/%D1%84%D0%B0%D0%B9%D0%BB.zip, that is, it converts the link to percent encoding, which may be the reason why it saves it doesn't render the filename "properly".
I posted a somewhat related question here, whose answer may or may not be of help to this one.
wget unicode
add a comment |
Sometimes a link has unicode characters in it, such as http://www.example.com/файл.zip
If you point your browser to it, it will properly prompt you to download the file as файл.zip. But if you try to do it with wget
, the file comes with a mix of ?, percent encoding (like %D0%BB) and the (invalid encoding)
string after the filename.
What parameters can I add to wget, or any other command line tricks, so that it behaves as Chrome and Firefox and saves the file exactly as specified in the rendered link - in this case, as файл.zip?
The solution should work without having to explicitly write it in the command, so an explicit wget -O файл.zip http://www.example.com/файл.zip
is not a good solution.
I realize that as soon as you run wget http://www.example.com/файл.zip
it tries to retrieve http://www.example.com/%D1%84%D0%B0%D0%B9%D0%BB.zip, that is, it converts the link to percent encoding, which may be the reason why it saves it doesn't render the filename "properly".
I posted a somewhat related question here, whose answer may or may not be of help to this one.
wget unicode
Sometimes a link has unicode characters in it, such as http://www.example.com/файл.zip
If you point your browser to it, it will properly prompt you to download the file as файл.zip. But if you try to do it with wget
, the file comes with a mix of ?, percent encoding (like %D0%BB) and the (invalid encoding)
string after the filename.
What parameters can I add to wget, or any other command line tricks, so that it behaves as Chrome and Firefox and saves the file exactly as specified in the rendered link - in this case, as файл.zip?
The solution should work without having to explicitly write it in the command, so an explicit wget -O файл.zip http://www.example.com/файл.zip
is not a good solution.
I realize that as soon as you run wget http://www.example.com/файл.zip
it tries to retrieve http://www.example.com/%D1%84%D0%B0%D0%B9%D0%BB.zip, that is, it converts the link to percent encoding, which may be the reason why it saves it doesn't render the filename "properly".
I posted a somewhat related question here, whose answer may or may not be of help to this one.
wget unicode
wget unicode
edited May 23 '17 at 12:39
Community♦
1
1
asked Dec 29 '12 at 4:22
StrapakowskyStrapakowsky
3,734112638
3,734112638
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You can use curl instead, as follow
curl -O http://www.example.com/файл.zip
It will save it to файл.zip.
add a comment |
For wget, you can use:
wget http://www.example.com/файл.zip --restrict-file-names=nocontrol
if your system can handle UTF-8 or other encoding properly.
Finally, if you still have those % symbols left in your downloaded file, you can use Python module urllib.unquote(filename)
that will replace %xx escapes by their single-character equivalent.
3
This should be marked as accepted answer, If the combination of this and everything else people do with wget(e.g. downloading recursively) could be done in curl OP and probably everyone else would have done it already.
– Behrooz
Jun 15 '15 at 17:57
Can be useful also--restrict-file-names=nocontrol
if file link is not final.
– ipeacocks
Feb 17 '16 at 23:54
add a comment |
I couldn't find a way to solve this issue with wget
but could successfully transfer the files with Midnight Commander.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f233882%2fhow-to-download-link-with-unicode-using-wget%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use curl instead, as follow
curl -O http://www.example.com/файл.zip
It will save it to файл.zip.
add a comment |
You can use curl instead, as follow
curl -O http://www.example.com/файл.zip
It will save it to файл.zip.
add a comment |
You can use curl instead, as follow
curl -O http://www.example.com/файл.zip
It will save it to файл.zip.
You can use curl instead, as follow
curl -O http://www.example.com/файл.zip
It will save it to файл.zip.
answered Dec 29 '12 at 5:09
John SiuJohn Siu
2,45611019
2,45611019
add a comment |
add a comment |
For wget, you can use:
wget http://www.example.com/файл.zip --restrict-file-names=nocontrol
if your system can handle UTF-8 or other encoding properly.
Finally, if you still have those % symbols left in your downloaded file, you can use Python module urllib.unquote(filename)
that will replace %xx escapes by their single-character equivalent.
3
This should be marked as accepted answer, If the combination of this and everything else people do with wget(e.g. downloading recursively) could be done in curl OP and probably everyone else would have done it already.
– Behrooz
Jun 15 '15 at 17:57
Can be useful also--restrict-file-names=nocontrol
if file link is not final.
– ipeacocks
Feb 17 '16 at 23:54
add a comment |
For wget, you can use:
wget http://www.example.com/файл.zip --restrict-file-names=nocontrol
if your system can handle UTF-8 or other encoding properly.
Finally, if you still have those % symbols left in your downloaded file, you can use Python module urllib.unquote(filename)
that will replace %xx escapes by their single-character equivalent.
3
This should be marked as accepted answer, If the combination of this and everything else people do with wget(e.g. downloading recursively) could be done in curl OP and probably everyone else would have done it already.
– Behrooz
Jun 15 '15 at 17:57
Can be useful also--restrict-file-names=nocontrol
if file link is not final.
– ipeacocks
Feb 17 '16 at 23:54
add a comment |
For wget, you can use:
wget http://www.example.com/файл.zip --restrict-file-names=nocontrol
if your system can handle UTF-8 or other encoding properly.
Finally, if you still have those % symbols left in your downloaded file, you can use Python module urllib.unquote(filename)
that will replace %xx escapes by their single-character equivalent.
For wget, you can use:
wget http://www.example.com/файл.zip --restrict-file-names=nocontrol
if your system can handle UTF-8 or other encoding properly.
Finally, if you still have those % symbols left in your downloaded file, you can use Python module urllib.unquote(filename)
that will replace %xx escapes by their single-character equivalent.
edited Dec 30 '18 at 9:12
clearkimura
3,83911954
3,83911954
answered Feb 1 '13 at 6:42
Balaji PurushothamBalaji Purushotham
33112
33112
3
This should be marked as accepted answer, If the combination of this and everything else people do with wget(e.g. downloading recursively) could be done in curl OP and probably everyone else would have done it already.
– Behrooz
Jun 15 '15 at 17:57
Can be useful also--restrict-file-names=nocontrol
if file link is not final.
– ipeacocks
Feb 17 '16 at 23:54
add a comment |
3
This should be marked as accepted answer, If the combination of this and everything else people do with wget(e.g. downloading recursively) could be done in curl OP and probably everyone else would have done it already.
– Behrooz
Jun 15 '15 at 17:57
Can be useful also--restrict-file-names=nocontrol
if file link is not final.
– ipeacocks
Feb 17 '16 at 23:54
3
3
This should be marked as accepted answer, If the combination of this and everything else people do with wget(e.g. downloading recursively) could be done in curl OP and probably everyone else would have done it already.
– Behrooz
Jun 15 '15 at 17:57
This should be marked as accepted answer, If the combination of this and everything else people do with wget(e.g. downloading recursively) could be done in curl OP and probably everyone else would have done it already.
– Behrooz
Jun 15 '15 at 17:57
Can be useful also
--restrict-file-names=nocontrol
if file link is not final.– ipeacocks
Feb 17 '16 at 23:54
Can be useful also
--restrict-file-names=nocontrol
if file link is not final.– ipeacocks
Feb 17 '16 at 23:54
add a comment |
I couldn't find a way to solve this issue with wget
but could successfully transfer the files with Midnight Commander.
add a comment |
I couldn't find a way to solve this issue with wget
but could successfully transfer the files with Midnight Commander.
add a comment |
I couldn't find a way to solve this issue with wget
but could successfully transfer the files with Midnight Commander.
I couldn't find a way to solve this issue with wget
but could successfully transfer the files with Midnight Commander.
answered Dec 30 '18 at 8:13
Daniel BöhmerDaniel Böhmer
1033
1033
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f233882%2fhow-to-download-link-with-unicode-using-wget%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown