Added encodeURIComponent, now working