代码页 65001 和 utf-8 是一样的吗?

发布于 2024-08-09 14:47:53 字数 394 浏览 10 评论 0原文

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

上面的代码对吗?

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Is the above code right?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

半山落雨半山空 2024-08-16 14:47:53

是的。

UTF-8 在 Windows 中是 CP65001(这只是在旧代码页中指定 UTF-8 的一种方式)。据我所知,当指定这种方式时,ASP 可以处理 UTF-8。

Yes.

UTF-8 is CP65001 in Windows (which is just a way of specifying UTF-8 in the legacy codepage stuff). As far as I read ASP can handle UTF-8 when specified that way.

开始看清了 2024-08-16 14:47:53

您的代码是正确的,尽管我更喜欢在代码中设置 CharSet 而不是使用元标记:-

<% Response.CharSet = "UTF-8" %>

代码页 65001 确实引用了 UTF-8 字符集。如果您的 asp 页面(以及任何包含内容)包含标准 ASCII 字符集之外的任何字符,您需要确保将它们保存为 UTF-8。

通过在 <%@ 块中指定 CODEPAGE 属性,您表明使用 Response.Write 写入的任何内容都应编码为指定的代码页,在本例中为 65001 (utf-8)。值得记住的是,这不会影响逐字发送到响应的任何静态内容。因此,文件需要使用指定的代码页实际保存。

响应的 CharSet 属性设置 Content-Type 标头的 CharSet 值。这对内容的编码方式没有影响,它只是告诉客户端正在接收什么编码。同样重要的是,他的值与发送的实际编码相匹配。

Your code is correct although I prefer to set the CharSet in code rather than use the meta tag:-

<% Response.CharSet = "UTF-8" %>

The codepage 65001 does refer to the UTF-8 character set. You would need be make sure that your asp page (and any includes) are saved as UTF-8 if they contain any characters outside of the standard ASCII character set.

By specifying the CODEPAGE attribute in the <%@ block you are indicating that anything written using Response.Write should be encoded to the Codepage specified, in this case 65001 (utf-8). Its worth bearing in mind that this does not affect any static content which is sent verbatim byte for byte to the response. Hence the reason why the file needs be actually saved using the codepage that is specified.

The CharSet property of the response sets the CharSet value of the Content-Type header. This has no impact on how the content my be encoded it merely tells the client what encoding is being received. Again it is important that his value match the actual encoding sent.

一个人的旅程 2024-08-16 14:47:53

是的,65001 是 UTF-8 的 Windows 代码页标识符,如文档所述 在 Microsoft 网站上

Wikipedia 还建议 IBM 代码页 1208 和 SAP 代码页 4110 也是 UTF-8 的指示符。

Yes, 65001 is the Windows code page identifier for UTF-8, as documented on the Microsoft website.

Wikipedia suggests also that IBM code page 1208 and SAP code page 4110 are also indicators for UTF-8.

苍风燃霜 2024-08-16 14:47:53
response.codepage = 65001

当物理文件保存为 utf-8 时,似乎会给出不好的结果,

否则,它会按预期工作。

response.codepage = 65001

seem to give bad result when the physical file is saved as utf-8

Otherwise, it work as it is supposed to.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文