Wrap username and password in encodeURIComponent to be URL safe.