Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a URL like this: (2013) [EN] [BR-Rip 720p] - [].rar

I want to download this URL using wget. If I pass it directly to wget, everything goes well. But I am in a situation that I have only the encoded versions of download URLs. If I pass the encoded version of the URL above to wget, it throws the following error:

$ wget ""
wget: unable to resolve host address ` (2013) [en] [br-rip 720p] - [].rar'

Notice that wget changed the casing of URL (for example Khumba to khumba). What should I do to solve this problem?

share|improve this question
up vote 17 down vote accepted

As this is annoyingly so common, there are various converters available - e.g. this site. You can use these to decode the URL - so it will convert this:

to: (2013) [EN] [BR-Rip 720p] - [].rar

It would be niCe to have a command line version though...


Found a command line version - basically:

echo "http%3A%2F%2F-REST-OF-URL" | sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' | xargs echo -e

This can be implemented in a script like this to decode the URL:

echo "$@" | sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' | xargs echo -e

which if saved and made executable, works quite nicely.

also this script, which will download the UL as well:

echo "$@" | sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' | xargs echo -e | wget -c -i -

N.B. I think the case the URL is in is not important for most sites - e.g. HTTP://WWW.UBUNTU.COM

share|improve this answer
python -c 'import urllib2; print urllib2.unquote("'${URL}'")' does approximately the same, if you put your url in environment variable URL. – taneli Mar 2 '14 at 20:54
The case for the domain is generally not important, but the case for what comes after can be if the server uses case-sensitive routing or does not redirect URLs with different case to the actual page. Case in point: versus – JAB Mar 3 '14 at 15:32

You should use it like this

wget "[EN]%20[BR-Rip%20720p]%20-%20[].rar"`

Just replace every space with %20 . Or Better copy your original link and paste it in Chromium Browser address bar. It will automatically format it for you. Now copy it from there to your terminal.

share|improve this answer
This method can be a security risk in some cases. If you already have Chromium open, it's probably the fastest way to press [Ctrl]+[Shift]+[J] (for the dev console) and insert decodeURIComponent("your-decoded-URI"). – ComFreek Mar 3 '14 at 9:02

Wget expects the URL to have the following format:


The protocol is optional. In absence of protocol, Wget assumes HTTP.

Wget accepts percent-encoded URLs just fine, but the delimiters between protocol, host and path cannot be percent-encoded.

This is also why Wget changed the casing of the URL. Since it didn't find a single unencoded slash, it assumes that (2013) [en] [br-rip 720p] - [].rar

is the hostname (which would be case-insensitive). The actual hostname is, of course,

For an automatic solution, substituting %3A%2F%2F and the %2F after the hostname by :// and / would suffice, but it's just as easy to decode the URL at one. @Wilf already gave a good solution for this.

However, if you're going to type the Wget command manually, just do this:

wget ""
share|improve this answer

You only need to put quotes around the url and done:

wget " (2013) [EN] [BR-Rip 720p] - [].rar"
Warning: wildcards not supported in HTTP.
--2014-03-02 20:40:20--[EN]%20[BR-Rip%20720p]%20-%20[].rar
Resolving (
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 594062365 (567M) [application/x-rar-compressed]
Saving to: ‘Khumba (2013) [EN] [BR-Rip 720p] - [].rar’

 0% [                                       ] 73,288      44.9KB/s          

Is easier that way and you don't have to embarrass yourself with stuff.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.