What is URL Encoding?
URL encoding, also known as percent-encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI). It replaces "unsafe" characters with a "%" followed by two hexadecimal digits.
Why is it Necessary?
URLs can only be sent over the Internet using the ASCII character-set. Since URLs often contain characters outside the ASCII set, they must be converted into a valid ASCII format. Special characters like spaces, commas, and ampersands must be encoded to avoid confusion with URL syntax.
- Space: Becomes
%20or+ - Special Chars:
&,?,=are encoded to prevent breaking query strings. - Non-ASCII: Characters like emojis or Hindi text are converted to percent-encoding.