Q: What characters need to be URL-encoded?
Characters that are not unreserved (A-Z, a-z, 0-9, -, _, ., ~) must be percent-encoded for safe use in URLs. This includes spaces (encoded as %20 or +), special characters like &, =, ?, and all non-ASCII characters.
Q: What is the difference between encodeURI and encodeURIComponent?
encodeURI preserves characters that are part of URL syntax (like :, /, ?, #), while encodeURIComponent encodes everything except unreserved characters. Use encodeURIComponent for query parameter values and encodeURI for complete URLs.
Q: How are international characters (Unicode) handled?
Unicode characters are first encoded to UTF-8 bytes, then each byte is percent-encoded. For example, the character "e" with an accent becomes %C3%A9. This ensures compatibility across all browsers and servers.
Q: Should spaces be encoded as %20 or +?
Both are valid but used in different contexts. %20 is the standard percent-encoding for spaces in URLs, while + is used in form data (application/x-www-form-urlencoded). Our tool uses %20 for general URL encoding.