added encodeURIComponent() function