use encodeURIComponent instead of encodeURI