Suppose I have an input field in a web page with charset UTF8
; suppose I open a text file encoded with ISO-8859-1
as charset.
Now I copy and paste a string with special characters (like, for example, ô
) from file to the input field : I see that the special characters is correctly displayed into input field.
Who does the conversion from ISO-8859-1
to UTF8
? The browser?
When you open the file and copy/paste it to the browser, it ends up in Unicode, as that is what the browser's UI controls use internally. Who actually performs the conversion from ISO-8859-1 to Unicode depends on a few factors (what OS you are using, whether your chosen text editor is compiled to use Ansi or Unicode, what clipboard format(s) - CF_TEXT
for Ansi, CF_UNICODETEXT
for Unicode - the app uses for the copy, etc). But either way, when the web browser submits the form, it then encodes its Unicode data to the charset of the HTML/form during transmission.
In all likelihood, it's not really converted to UTF-8, but instead to the internal representation of characters used by the browser, which is quite likely to be UTF-16 (no matter what the encoding of the web page is).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With