What's the difference between encodeURI and encodeURIComponent?
Full URI mode runs encodeURI, which leaves URI-reserved characters (: / ? # [ ] @) unescaped since they're structural. Component mode runs encodeURIComponent, which escapes those too — the right choice for a single query parameter's value rather than a whole URL.