As useful as special characters are in the English language, you'd think that you could type all of them in your browser's URL bar. Only a small subset of US-ASCII characters are safe to use in URLs. Other characters, such as the apostrophe, are reserved for special use. If you need to enter a URL into your browser that has an apostrophe, encode the apostrophe. Encoding ensures that all websites and browsers interpret the complete URL correctly.
Video of the Day
Encode Your Apostrophe
You can navigate to Web pages using several methods, such as clicking a bookmark or typing a URL into a browser's address bar. If the URL you need to type contains an apostrophe, replace the apostrophe with %27 and press "Enter" to navigate to the URL.
Apostrophe Replacement Examples
The URL http://www.example.com/jim's_burgers is an example of a URL that contains an apostrophe. After you replace the apostrophe with %27, the URL becomes http://www.example.com/jim%27s_burgers. Another example of an encoded URL is http://www.example.com/cities/denver%27s_altitude.html. In this instance, denver%27s_altitude.html refers to an HTML document named denver's_altidude.html that resides in the Cities directory on the Web server.
Why Encoding Works
It may not make sense to humans, but computers know that 27 is the hexadecimal representation of the apostrophe's ASCII value. Created in the '60s, the ASCII character set forms the foundation upon which computers work with text. Each character on your computer keyboard is an ASCII character that has a decimal number that computers associate with the character. For instance, the decimal equivalent of H is 72. An apostrophe's decimal value is 39. If you convert 39 into a hexadecimal number, you get 27, the value you use to replace apostrophes in URLs. By convention, the percent sign precedes these numbers.
Encode Other Characters
You can encode other characters in a URL by replacing them with their hexadecimal ASCII equivalents. You can find those values by visiting a site that contains an HTML URL encoding reference table (link in Resources). These tables usually list ASCII characters in one column and their corresponding hexadecimal values in another. For example, if you find the plus sign in one of these tables, you'll see that its encoded value is %2B.
Domain Name Restrictions
If you register a domain name, the name cannot have hex encoding in it. In other words, you cannot register a new domain named jim%27s_cameras if you wanted to create a site named Jim's_Cameras.