Details on submitting forms in HTTP with national characters

by Anton Tagunov

The server choses a character encoding for a page, sends it to the browser in the Content-Type HTTP header and then sends character data encoded with this character encoding:

HTTP/1.1 200 OK
Content-Type: text/html; charset=xxx

data encoded in the xxx charset

The browser similarly peeks up the character encoding from the Content-Type header, encodes form parameters in this encoding and sends them back to server:

GET <path-to-the-web-page>?<encoded-query> HTTP/1.1
Host: <the-web-host>

In our previous example with a.jsp and b.jsp pages, provided that we have chosen the UTF-8 encoding this will look like: (the page that contains the web form)

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8

<HTML><BODY>
<FORM METHOD="GET" ACTION="b.jsp">
<INPUT TYPE="TEXT" NAME="n">
<INPUT TYPE="SUBMIT">
</FORM>
</BODY></HTML>

And the result of submitting the form looks like

GET <path-to-the-web-application>/b.jsp?n=a%D0%B0 HTTP/1.1
Host: <the-web-host>