
URL decode hands your text to the browser's own decodeURIComponent, and, with plusAsSpace on, first turns every literal plus sign into a space the way form-encoded data expects. A percent sequence decodeURIComponent cannot parse is refused, with the error pointing at the bad % when it can be found. Bytes forming valid UTF-8 print as text; anything else downloads as decoded.bin.
Questions
What does plusAsSpace do?
It swaps every literal + for a space before decoding, matching how form-encoded (application/x-www-form-urlencoded) data represents spaces.
What happens with invalid percent-encoding?
The tool refuses, naming the offset of the bad % sequence when it can find one.
What does the output look like?
Valid UTF-8 text prints directly; anything else downloads as decoded.bin instead of showing broken characters.
What does the decoding?
The browser's own decodeURIComponent, so every percent escape follows the same rules a page applies.
Can I use this from the command line?
Yes, the same code runs on the page, the CLI and MCP.