Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what encoding it is?

If i have a HTML page with setting to be UTF-8. and then I input Chinese characters with encoding big5 in the form and submit. what encoding it is at server side ? is it automatically converted to UTF-8? Or how it works ?? Thanks!

Supplement1: Actually i am really not sure, why the browser can decide which encoding to use ? since the encode was generated by IME. for example: the tool i used to input Chinese character, right ?

supplement2: if everything just like what "Michael Madsen" said at the below response, then how can asp.net handle this, such that whatever and no matter how i input the characters in the forms, it will not get corrupted always but jsp can't?

like image 980
MemoryLeak Avatar asked May 11 '26 08:05

MemoryLeak


1 Answers

The browser works with Unicode - when the characters are typed in there, they're internally stored as Unicode. When the form is submitted, it outputs the characters in whatever encoding is appropriate - usually the encoding of the page.

If you're talking about copy/pasting from a Big5 document, then it will already have been converted to Unicode when it's inserted into the clipboard - maybe even when the document is loaded, depending on your editor.

If you're talking about using some IME to input the characters, the question is kind of faulty, since your IME should be working exclusively with Unicode and Big5 encoding is therefore never involved. If it is, then there's some layer inbetween doing the conversion to/from Unicode anyway, so regardless of that part, the browser never knows the source encoding.

like image 51
Michael Madsen Avatar answered May 14 '26 12:05

Michael Madsen