sytech's answer (which I have accepted) is certainly correct as it quotes the spec, but since the spec is rather vague, here's an overview how some web frameworks actually handle the matter:
RFC6265: "for example Base64"
PHP: URL encode
Go: raw
Node.js + Express: URL encode