How percent-encoding works
Characters outside the unreserved set A–Z a–z 0–9 - _ . ~ are converted to their UTF-8 bytes and each byte is written as % followed by two hex digits. A space becomes %20; "ë" (2 UTF-8 bytes) becomes %C3%AB.
Component vs full URL
encodeURIComponent also encodes / ? : @ & = + $ , #, so use it for a single query value or path segment. encodeURI leaves those reserved characters alone so a complete URL stays usable.
| Character | encodeURIComponent | encodeURI |
|---|---|---|
| space | %20 | %20 |
| / | %2F | / |
| ? | %3F | ? |
| & | %26 | & |
| = | %3D | = |
| # | %23 | # |
| é | %C3%A9 | %C3%A9 |
Why + sometimes means space
HTML forms submitted as application/x-www-form-urlencoded encode spaces as +. In a path, a + is a literal plus sign. Tick or untick "Decode + as space" to match your source.