I’m writing code, which takes the raw body of the post request (from a form, basically) and splits it into variables. Then it does some recoding on them and spits out the recoded post body back to output.
My question is if I can safely assume that splitting the body by the “&” character and then by “=” on the elements of the resulting array will get me variable names and values. Or are there some escape sequences which could possibly make my code produce nonsense on the output?
Yes, it is safe, if
enctypeof the form isapplication/x-www-form-urlencoded(default value)Reference:
HTML 4.01 Specification – Forms
RFC1738