What ASCII characters are not allowed in HTTP requests (particularly via POST and application/x-www-form-urlencoded
)? (one is '+')
Asked
Active
Viewed 2,550 times
1

Moradnejad
- 3,466
- 2
- 30
- 52
-
1What kind of request (`POST`, `GET`)? In the request header or in the request body? What content type? What encoding? [This](http://stackoverflow.com/q/14551194/841108) question is similar to yours (but not exactly the same)... – Basile Starynkevitch Nov 28 '15 at 14:32
-
1The direct answer to your question can be found by Googling `allowed characters in url` .... but you should probably elaborate what exactly went wrong at which point? – Pekka Nov 28 '15 at 14:38
-
1@BasileStarynkevitch as it is mentioned in the question, via POST, and ASCII encoding. It's a simple string parameter. – Moradnejad Nov 28 '15 at 14:40
-
1@Pekka웃 i was mostly thinking generally and i just brought an example why this is a question for me. – Moradnejad Nov 28 '15 at 14:42
-
for `POST`, the `Content-type` is *very often* `application/x-www-form-urlencoded` but it could be something else – Basile Starynkevitch Nov 28 '15 at 14:43
-
@BasileStarynkevitch yes. i didn't know it's title, but my work is for submitting forms. i updated the question. – Moradnejad Nov 28 '15 at 14:47
-
STFW gives [percent-encoding](https://en.wikipedia.org/wiki/Percent-encoding#The_application.2Fx-www-form-urlencoded_type) wikipage, but the browser it taking care of that – Basile Starynkevitch Nov 28 '15 at 14:51
-
I think you are missing my question here. simplified of my question: suppose it is a programming code. what characters should i replace? – Moradnejad Nov 28 '15 at 14:52
1 Answers
7
If the form is encoded with application/x-www-url-encoded, which is the default for HTML forms, the only characters you can definitely use are:
- 0-9
- a-z
- A-Z
- $ - _ . ! * ' ( ) , "
"+" means space. Everything else can have a special meaning.
If you are using multipart/form-data, then you can send anything anyhow. If you are using an HTML form, add the enctype property, like so:
<form method="post" enctype="multipart/form-data">

ben720
- 86
- 3
-
`+` has a special meaning for `application/x-www-form-urlencoded` encoding – Basile Starynkevitch Nov 28 '15 at 15:12