Problem with "decodeURIComponent" #1232
Replies: 7 comments
-
Posted at 2018-11-01 by @gfwilliams Can you give me an example of just running 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 Looking online it seems that is the accepted way of doing it: https://stackoverflow.com/a/24417399/1215872 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-11-01 by @allObjects Your html has an issue: the div inside the form is not closed... because I wondered why the browser would send so much additional stuff as you point out...
For testing, I created this html (including the submit - which is not really needed), and served it from local 127.0.0.1 and posted it back there (to a not defined page - which does not matter, though, because - so far - I'm only interested in verifying/debugging the request...). What my browser - Chrome - tells me in the debugger/inspector, is attached as screenshots - encoded and parsed... and I see different (my ...and btw, even with the messed up form and submit absent, I see the same posted by the browser, as the 3rd screenshot shows. I'm interested in your screenshots... Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-11-01 by iwae
That is exactly what I do to fix it but I thought that decodeURIComponent should already result the same.
I expected that a space would be
not just an "+". Confusing for me :) Thank you for your help! PS: Espruino is very cool :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-11-01 by @allObjects
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-11-02 by Robin
Thr 2018.11.01
Consult the Book of Armaments ! The spec says it all . . . .
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-11-02 by @gfwilliams
You'd think so wouldn't you? It's one of those cases where I'd love to make |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-11-02 by iwae It's already great :) I saw that the spec defines that behaviour. So we can't do something different :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-11-01 by iwae
Hi guys,
i have a problem with sending some data with an simple http form.
HTML Code:
JS on Espruino
If I enter the following to the form: "PLUS++++LEER OK"
The browser send: "PLUS%2B%2B%2B%2BLEER+++++OK"
On espruino: test=PLUS%2B%2B%2B%2BLEER+++++OK
Now I call the "decodeURIComponent" but the result is
"PLUS++++LEER+++++OK"
I would expect the following: "PLUS++++LEER OK"
https://www.w3schools.com/tags/att_form_enctype.asp
You have the same behaviour? The blank issnt decoded correctly.
Beta Was this translation helpful? Give feedback.
All reactions