URLs can’t contain spaces, &, ? or many other characters inside a value. URL encoding, also called percent-encoding, replaces them: a space becomes %20, & becomes %26.
In Terminal
macOS has no urlencode command, but Python does it in one line:
python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe=""))' 'name=Jane Doe&city=São Paulo'
Decode:
python3 -c 'import sys, urllib.parse; print(urllib.parse.unquote(sys.argv[1]))' 'S%C3%A3o%20Paulo'
safe="" encodes / too, which you want for a single value. Leave it out to keep slashes in a path.
From the notch
NotchMind, which I make, has URL encode and URL decode on its Developer Tools page. Paste, press the arrow and copy. It handles UTF-8, so accented letters come out right. See developer tools in the notch.
Encode the value, not the whole URL
Encode each value you put after =, not the full address, or https:// turns into https%3A%2F%2F.
NotchMind