NOTE
2.12 URL Encoding
A short historical note on why URL encoding is needed and how URLs are encoded.
This is a historical learning note and may contain outdated or incomplete understanding.
1. Why Is URL Encoding Needed?
A URL can use only English letters, Arabic numerals, and certain punctuation marks; other text and symbols cannot be used directly. Other characters need to be escaped using % character encoding.
2. How to Encode
- In the path: UTF-8 encoding is used.
- In GET query parameters: the operating system’s default encoding is used.
Use
encodeURIfor encoding.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub