tags:

views:

35

answers:

2

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?

A: 
Rubens Farias
+2  A: 

Yes, it is safe, if enctype of the form is application/x-www-form-urlencoded (default value)

Reference:

HTML 4.01 Specification - Forms

RFC1738

Iamamac