谁进行复制/粘贴转换?
假设我在网页中有一个字符集 UTF8
的输入字段;假设我打开一个使用 ISO-8859-1
作为字符集编码的文本文件。
现在,我将包含特殊字符(例如 ô
)的字符串从文件复制并粘贴到输入字段:我看到特殊字符已正确显示到输入字段中。
谁将 ISO-8859-1
转换为 UTF8
?浏览器?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您打开文件并将其复制/粘贴到浏览器时,它最终会以 Unicode 形式出现,因为这是浏览器的 UI 控件在内部使用的内容。谁实际执行从 ISO-8859-1 到 Unicode 的转换取决于几个因素(您使用的操作系统、您选择的文本编辑器是否编译为使用 Ansi 还是 Unicode、什么剪贴板格式 -
CF_TEXT< /code> 用于 Ansi,
CF_UNICODETEXT
用于 Unicode - 应用程序用于复制等)。但无论哪种方式,当 Web 浏览器提交表单时,它都会在传输过程中将其 Unicode 数据编码为 HTML/表单的字符集。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.很可能,它并没有真正转换为 UTF-8,而是转换为浏览器使用的字符的内部表示形式,这很可能是 UTF-16(无论网页的编码是什么)。
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).