So I have a page, and try to submit a form along with user-entered data.
Demo: http://jsfiddle.net/DerekL/Cck8Q/
However, the browser sends out the data in UTF-8, while the server requires it to be in Big5. Basically this means,
encodeURIComponent("電") //"%E9%9B%BB"
this is not using the correct character set, and the correct string should be
%B9q
Is there anyway to "make" the browser to send the data using Big5? JavaScript conversion indeed is possible, but it would end up like this.
If you're only looking for encoding in HTML form submission, not JS encoding conversion, you can take advantage of the
accept
attribute (HTML4) and/oraccept-charset
attribute (HTML5) of<form>
:Online demo (Checked on a Chrome on XP Simplified Chinese version).
MDN document about
<form>
attributes