Is there any use to adding accept-charset = "UTF-8" to HTML forms if the page is already in UTF-8?

For pages that are already specified (either with an HTTP header or meta tags) to have a Content-Type encoded in UTF-8 ... is there any advantage to adding accept-charset="UTF-8" forms in HTML?

(I understand that the accept-charset attribute is broken in IE for ISO-8859-1, but I have not heard of a problem with IE and UTF-8. I just ask if it is possible to add it with UTF-8 to prevent invalid entries byte sequences.)

+48
html encoding forms utf-8 character-encoding
Sep 15 '10 at 17:03
source share
2 answers

If the page is already interpreted by the browser as UTF-8, setting accept-charset="utf-8" does nothing.

If you set the page encoding to UTF-8 in the <meta> and / or HTTP header, this will be interpreted as UTF-8 if the user does not intentionally go to the View-> Encoding menu and select a different encoding, overriding the one you specified.

In this case, accept-encoding will affect the sending encoding setting back to UTF-8 in the face of involving the user in the page encoding. However, this still will not work in IE due to the previous issues discussed with accept-encoding in this browser.

Thus, the IMO doubts whether it is worth enabling accept-charset to fix the case when a non-IE user deliberately sabotaged the page encoding (perhaps more useless on your page than just the form).

Personally, I'm not worried.

+33
Sep 15 '10 at 19:28
source share

I had no problems using UTF-8 with IE (6+) or any other major browser. You need to make sure that the UTF-8 meta tag is installed (IE is required for this), and that all your files are encoded in UTF-8 encoding (which means the web server sends UTF-8 headers). Then there should be no problem if you omit accept-charset .

+3
Sep 15 '10 at 17:08
source share



All Articles