Replace encodeURI with RFC3986-compliant version