Know more about URL Encoding

Know more about URL Encoding

March 22, 2019
2 min read
801 views
0

Know more about URL Encoding

A URL is another word for a web address. URL can be composed of words or an IP address. Most people use the name when surfing because names are easier to remember than numbers. URL stands for Uniform Resource Locator. It's used more generally within the main Uniform Resource Identifier (URI) set, which includes both Uniform Resource Locator (URL) and Uniform Resource Name (URN).

URL encoding is the process of converting string into valid URL format. Valid URL format means that the URL contains only what is termed "alpha | digit | safe | extra | escape" characters. Most web programming languages already provide built in method to perform URL Encoding and URL Decoding. It's normally performed to convert data passed via html forms.

Where URL Encoding is the process of converting a string into a valid URL format. The valid URL format means that the URL should not contain any unprintable characters or characters with special meaning. URL Encoding helps to represent unambiguous and universally accepted characters for web browsers and servers.

The most commonly encoded character in URL string is the <space> character. You can see plus-sign (+) whenever space in a URL. The plus sign acts as a special character representing that space in a URL.

How could you encode a URL?

To encode a URL, you simply replace the special characters with their encoding string. Nearly most of the special characters encoding begin with a % character followed by a hexadecimal number.

If you don't want to do encode items by hand, you can use the predefined function found in both client and server side languages, such as encodeURI(string) - JavaScript, urlencode(string) - php, encode(string, "UTF-8") - Java etc.

What should be encoded?

Any character that is not an alphabet, a number, or a special character that is being used outside its normal context is going to need to be encoded in your page.

But, If you were writing special characters for HTML instead of URL then you need to add an ampersand, you could not use %26. Instead, you would use either "&amp;" or "&#38;", both of which would write out the & in the HTML page when rendered.

Was this article helpful?Vote to let the author know
0
Share this article

Loading comments...

Related Articles

Why Did Apple Really Remove the Headphone Jack? The $15 Billion Truth Nobody Talks About

Why Did Apple Really Remove the Headphone Jack? The $15 Billion Truth Nobody Talks About

Apple removed the 3.5mm headphone jack from the iPhone 7, claiming it took "Courage." They told us it was to make phones thinner, improve waterproofing, and deliver better audio. But 10 years later, looking at the numbers, was it really about design—or was it a $100 Billion illusion?

14 views
Read More
Read full article: Why Did Apple Really Remove the Headphone Jack? The $15 Billion Truth Nobody Talks About
Cloud Hosting India: Which Provider is the Best? Complete Guide

Cloud Hosting India: Which Provider is the Best? Complete Guide

Cloud hosting uses a network of interconnected servers rather than relying on a single physical machine. Your website or application runs on virtualized infrastructure, allowing resources such as CPU, RAM, storage, and networking to be allocated according to workload requirements

14 views
Read More
Read full article: Cloud Hosting India: Which Provider is the Best? Complete Guide