Consumers Guide to Making Money Online.org

Top-rated free and inexpensive tools, tips and tutorials to help you design, build and maintain your website!

Home LinkRepairman Feedback Resource List Search

 

Up
Encoding

Free Tools: URL Encoder

Returns a string in which all non-alphanumeric characters replaced with a percent sign followed by two hex digits and spaces encoded as plus signs. This tool is useful when you want to create links which contain special characters.
 

URL to encode:

URL to encode:

$URL = $_POST['URL']; $encoded = urlencode($URL); $doubleenc = urlencode($encoded); $rawencoded = rawurlencode ( $URL); ?>

Encoded:

Double encoded:

Raw encoded:

What does this mean / how is this useful?

URL Encoding

Returns a string in which all non-alphanumeric characters except the dash (-), the underscore (_) and the comma (,) have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in application/x-www-form-urlencoded media type.  If you are passing data in a url (in the query portion, that is everything after the question mark), if you don't URL-encode it, any non-alphanumeric characters other than the dash (-), the underscore (_) and the comma (,) will not be read correctly by the browser.

Double encoding

If you want to pass a url with parameters as a value IN a url AND through a javascript function, such as...

   <a href="javascript:openWin('page.php?url=index.php?id=4&pg=2');">

you will need to encode the url twice. If you don't do this, you'll find that the result url value in the target script is missing all the var=values following the ? question mark...

Raw Encoding

All non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits. This is the encoding described in RFC 1738 for protecting literal characters from being interpreted as special URL delimiters, and for protecting URL's from being mangled by transmission media with character conversions (like some email systems). This differs from urlencoding (above) in that spaces are encoded as %20 rather than a plus sign (+). This is useful if you need to encode apostrophes; in this case you should be using rawurlencode as opposed to just urlencode.

 

URL Encoding Tool © Dev Mechanic

URL
URL to Encode

Send us an email to:   Copyright Benivia, LLC, 2005