Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A form was submitted in the windows-1252 encoding

I am getting the following warning in the JS tab of the Firefox web console (Ctrl + Shift + K)

A form was submitted in the windows-1252 encoding which cannot encode all Unicode characters, so user input may get corrupted. To avoid this problem, the page should be changed so that the form is submitted in the UTF-8 encoding either by changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8 on the form element. @ http://localhost:8080/myapp/login

The html does use the utf-8 encoding explicitly, like so:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />;

The html (actually Freemarker templates) files were previously on a Windows machine. So I recoded them to utf-8 using the recode utility as suggested here. But I still see the same warning.

What am I missing here?

There is no warning or error in the Chrome's developer tools utility (Ctrl + Shift + I)

like image 854
arahant Avatar asked Jan 07 '13 13:01

arahant


1 Answers

Based on the comment, it seems obvious that the server specifies the encoding as ISO-8859-1 in HTTP headers. You cannot override this in HTML for the document itself. You can, however, use the accept-charset=utf-8 attribute in the form tag to specify the character encoding of the form data submission.

To change the HTTP headers, you need to do something at the server level. This may mean creating or editing a .htaccess file, or something else.

P.S. The Accept-Encoding header is unrelated to this. It does not specify character encoding but a transfer encoding for the data.

like image 190
Jukka K. Korpela Avatar answered Feb 11 '23 07:02

Jukka K. Korpela