URL encoding with curl and Linux command line

Command to use:  curl

Environment:  Any Unix/Linux installed with curl

Encoding options:   iconv -f iso8859-1 -t utf-8 and don’t forget to put your URL in single quote…

Error handling:  2>/dev/null

Output to file: -o <path>


  • curl 2>/dev/null -s ‘http://hostname:port?var=This+is+a+simple+%26+short+test” | iconv -f iso8859-1 -t utf-8 -o /tmp/output.xml
Here is special character table:

URL Encoded

; %3B
? %3F
/ %2F
: %3A
# %23
& %26
= %3D
+ %2B
$ %24
, %2C
<space> %20 or +
% %25
< %3C
> %3E
~ %7E
% %25
URL encoding support in different language.
Languagege URL Encoding URL Decoding
VBScript escape(string) unescape(string)
.NET HttpUtility.UrlEncode HttpUtility.UrlDecode
Java java.net.URLEncode.encode(String)
or see this link.
See this link.
JavaScript escape(String) Note: does not encode ‘/’ and ‘+’ character unescape(String)
PHP urlencode(string) urldecode(string)
ASP Server.URLEncode(string) ?
Perl uri_escape 
Use CGI.pm module.  Link.
Flash (MX or later) escape(expresiion) unescape(expression)
Post Reads: 19261

About The Author

We are group of Unix/Linux Admins and have more than 15 years of IT experience in RedHat, FreeBSD, Solaris, AIX, HP-UX, SAN storage, Firewalls, IT Security, Database and Opensource softwares.

Related posts


  1. raj

    hey man nice blog . Your blog contain knowledge base information.

    it help too much user .

    keep it up


Leave a Reply

Your email address will not be published. Required fields are marked *

× 2 = fourteen