Component vs full URL
Encode component (encodeURIComponent) encodes everything including / ? & = — use it for individual query-string values. Encode full URL (encodeURI) keeps URL structure characters intact — use it to fix spaces and unicode in a whole address.