Use encodeURIComponent instead of encodeURI
Typo