I wonder what the right way is to encode a form value when it is send to an .asp page with a XMLHttpRequest
and then decode it on the .asp page before I insert it to my db. So I can use characters like this #%?´:;!+-'
Do I use encodeURIComponent(the string value here)
So lets say the form is in page1.asp
<form action="#" id="saveuploads" ENCTYPE="multipart/form-data" class="form-ajax-submit">
<input type="text" name="artikel" >
</form>
// lets say I have a string in the form with the value `#%?´:;!+-'`
artikel=encodeURIComponent('#%?´:;!+-'')
fdu.append("artikel", artikel);
var xhr = new XMLHttpRequest();
xhr.open("POST", "upload2.asp");
xhr.send(fdu);
And then in page2.asp Should I decode it with
artikel=decodeURIComponent(request.form("artikel"))
And then insert artikel to db...
Any input appreciated, thanks.