Two content encoding methods are available when sending data from a HTTP client browser to a HTTP server.
Both methods do not identify the byte encoding used by the client browser so the conversion of client data to the encoding of the server can be problematic if the characters are not in the ASCII range.
It has been observed that some browsers will use the content-type charset attribute to override the default client browser encoding that is applied to the INPUT form data being posted to the server.
If the HTML page has been served from the server using a content-type charset attribute then this will have the same effect as a meta tag within the HTML document.
To control the byte encoding used by the HTTP client browser using a meta tag in the HTML document.
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<head>
Using a charset value of utf-8 means that the HTML FORM post from any client locale will be received by the server UTF-8 encoded.
Method 1: multipart/format-data
HTML source:
<FORM METHOD="POST" ACTION="http://server1:88/cgi-bin/jsmdirect?upload" ENCTYPE="multipart/form-data">
<INPUT NAME="SONUMBER" TYPE="TEXT" VALUE="12345"/></TD></TR>
<INPUT NAME="CUSTNAME" TYPE="TEXT" VALUE="ABC Industries"/></TD></TR>
<INPUT NAME="STREET" TYPE="TEXT" VALUE="123 Main St"/></TD></TR>
<INPUT NAME="CITY" TYPE="TEXT" VALUE="Chicago"/></TD></TR>
<INPUT NAME="POSTCODE" TYPE="TEXT" VALUE="60609"/></TD></TR>
<INPUT NAME="FILE" TYPE="FILE" SIZE ="60"/>
<INPUT TYPE="SUBMIT" VALUE="Send"/>
</FORM>
Content type:
multipart/form-data; boundary=---------------------------7d37e321500b2
Content:
-----------------------------7d37e321500b2
Content-Disposition: form-data; name="SONUMBER"
12345
-----------------------------7d37e321500b2
Content-Disposition: form-data; name="CUSTNAME"
ABC Industries
-----------------------------7d37e321500b2
Content-Disposition: form-data; name="STREET"
123 Main St
-----------------------------7d37e321500b2
Content-Disposition: form-data; name="CITY"
Chicago
-----------------------------7d37e321500b2
Content-Disposition: form-data; name="POSTCODE"
60609
-----------------------------7d37e321500b2
Content-Disposition: form-data; name="FILE"; filename=""
Content-Type: application/octet-stream
-----------------------------7d37e321500b2--
Method 2: application/x-www-form-urlencoded
HTML source:
<FORM METHOD="POST" ACTION="http://server1:88/cgi-bin/jsmdirect?upload">
<INPUT NAME="ORDER" TYPE="TEXT" VALUE="12345"/></TD></TR>
<INPUT NAME="CUSTNAME" TYPE="TEXT" VALUE="ABC Industries"/></TD></TR>
<INPUT NAME="STREET" TYPE="TEXT" VALUE="123 Main St"/></TD></TR>
<INPUT NAME="CITY" TYPE="TEXT" VALUE="Chicago"/></TD></TR>
<INPUT NAME="POSTCODE" TYPE="TEXT" VALUE="60609"/></TD></TR>
<INPUT TYPE="SUBMIT" VALUE="Send"/>
</FORM>
Content type:
application/x-www-form-urlencoded
Content:
ORDER=12345&CUSTNAME=ABC+Industries&STREET=123+Main+St&CITY=Chicago&POSTCODE=60609