Who does the conversion for copy / paste?

Suppose I have an input field on a UTF8 encoded webpage; Suppose I open a text file encoded using ISO-8859-1 as an encoding.

Now I copy and paste the line with special characters (for example, รด ) from the file into the input field: I see that special characters are displayed correctly in the input field.

Who performs the conversion from ISO-8859-1 to UTF8 ? Browser?

+4
source share
2 answers

When you open the file and copy / paste it into the browser, it ends in Unicode, as the browser user interface is used internally. Who actually performs the conversion from ISO-8859-1 to Unicode depends on several factors (which OS you use, regardless of whether your selected text editor is compiled to use Ansi or Unicode, which clipboard format (s) - CF_TEXT for Ansi, CF_UNICODETEXT for Unicode - the application uses for copying, etc.). But anyway, when the web browser submits the form, it then encodes its Unicode data into HTML / form encoding during the submission.

+2
source

In all likelihood, it will not be converted to UTF-8, but instead to the internal representation of the characters used by the browser, which is likely to be UTF-16 (regardless of what the encoding of the web page is).

+3
source

All Articles