I use meta-refresh tag in my html page. The html page has a form. When this page is auto-refreshed, all form parameters are appended to url as HTTP GET parameter.
Problem: All space characters i.e '%20' is converted to '+' automatically. But my FORM Query params may themselves have '+' characters in their content. So
- How do I stop spaces replaced by '+' and go back to encoding space with '%20'?
OR
- How do I correctly encode and decode Form params to properly differentiate between space-representing '+' and literal parameter '+' ?
E.G.
properTitle = "This is example for correctly decoding HTTP Form parameters space replaced with '+'" encodeURIComponent(properTitle) : This%20is%20example%20for%20correctly%20decoding%20HTTP%20Form%20parameters%20space%20replaced%20with%20'%2B'
escape(properTitle) : This%20is%20example%20for%20correctly%20decoding%20HTTP%20Form%20parameters%20space%20replaced%20with%20%27+%27
After meta-refresh skewedTitle = "This+is+example+for+correctly+decoding+HTTP+Form+parameters+space+replaced+with '+'"
decodeURIComponent(skewedTitle) : This+is+example+for+correctly+decoding+HTTP+Form+parameters+space+replaced+with+'+
escape(skewedTitle) : This+is+example+for+correctly+decoding+HTTP+Form+parameters+space+replaced+with+%27%252B%27
P.S: I have already referenced following similar questions but no help.
When to encode space to plus (+) or %20?
In a URL, should spaces be encoded using %20 or +?
EDIT 1: Thanks to @Bergi, I have solved my problem by manually encoding '+' character to '%2b' before refresh itself. After meta-refresh '%20' is converted to '+' which is different from '%2b'. Shouldn't there be a proper method to take care of such encoding and decoding ?