gpt4 book ai didi

html - utf-8/utf-16 转换

转载 作者:太空宇宙 更新时间:2023-11-04 16:20:56 28 4
gpt4 key购买 nike

当我在 Dreamweaver CS6 中设计一个 html 页面时,我使用它的验证工具(它将代码发送到 w3c)并且我没有得到任何错误。但是,当我在 UltraEdit 21(它使用 HTML Tidy)中验证同一页面时,我收到警告:“指定的输入编码(utf-8)与实际输入编码(utf-16)不匹配”

页面设置为 html5(带 <!doctype html> )、utf-8(带 <meta charset="utf-8"> )并包含希腊文本。

好吧,问题是:

  1. 这个问题会影响页面的外观吗?我的意思是,当我发布它时,中国、德国或...火地岛的用户会看到希腊文本吗?

如果是,其余的就不那么重要了,但我会问他们:

  1. 是什么让 HTML Tidy 将文档定义为 utf-16?是否有任何类型的字符、单词或可见字符串可供我删除/删除以更正问题?

  2. 如果我使用 <meta charset="utf-16">浏览器是否会正确解析代码(以全局用户的希腊文本结尾)?

最佳答案

实际的文件编码将在文件的 Dreamweaver 属性中设置。

Dreamweaver Help / Set title and encoding properties for a page :

The Title/Encoding Page Properties options let you specify the document encoding type that is specific to the language used to author your web pages as well as specify which Unicode Normalization Form to use with that encoding type.

  1. Select Modify > Page Properties, or click the Page Properties button in the text Property inspector.

  2. Choose the Title/Encoding category and set the options.

    ...

    Encoding Specifies the encoding used for characters in the document.

    If you select Unicode (UTF‑8) as the document encoding, entity encoding is not necessary because UTF‑8 can safely represent all characters. If you select another document encoding, entity encoding may be necessary to represent certain characters. For more information on character entities, see www.w3.org/TR/REC-html40/sgml/entities.html.

    ...

    Include Unicode Signature (BOM) Includes a Byte Order Mark (BOM) in the document. A BOM is 2 to 4 bytes at the beginning of a text file that identifies a file as Unicode, and if so, the byte order of the following bytes. Because UTF‑8 has no byte order, adding a UTF‑8 BOM is optional. For UTF‑16 and UTF‑32, it is required.

选择不带 BOM 的 UTF-8。

关于html - utf-8/utf-16 转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29298932/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com