-
However it's not desperately helpful for what you're trying to do. You could try decodeURIComponent(els[1].replace(/+/g," "));
That is exactly what I do to fix it but I thought that decodeURIComponent should already result the same.
It seems that it is my fault. Why are spaces something so special?application/x-www-form-urlencoded Default. All characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values)
https://www.w3schools.com/tags/att_form_enctype.aspI expected that a space would be
U+0020   Space
not just an "+".
Confusing for me :)
Thank you for your help!
PS: Espruino is very cool :)
-
ref#4 Why are spaces something so special? not just an "+" Confusing for me
Thr 2018.11.01
From Monty Python's the Holy Grail
Consult the Book of Armaments !
The spec says it all . . . .
https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
Can you give me an example of just running
decodeURIComponent
where it's not doing what you expect?With your example I get:
So I'd say it's behaving as expected.
However it's not desperately helpful for what you're trying to do. You could try
decodeURIComponent(els[1].replace(/+/g," "));
Looking online it seems that is the accepted way of doing it: https://stackoverflow.com/a/24417399/1215872