如果您在页面上坚持使用 UTF-8,它们应该可以工作(但请参阅下面的重要说明)。虽然 Access 确实不会在内部将 Unicode 字符存储为 UTF-8,但 Access OLEDB 驱动程序会为您处理转换。
考虑以下示例脚本(65001
UTF-8 的“代码页”在哪里):
<%@ CODEPAGE = 65001 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Classic ASP Unicode Test</title>
</head>
<body bgcolor="white" text="black">
<%
Dim con, cmd, rst
Const adVarWChar = 202
Const adParamInput = 1
Set con = CreateObject("ADODB.Connection")
con.Mode = 3 ' adModeReadWrite
con.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\_wwwdata\unicodeTest.mdb;"
If Len(Trim(Request.Form("word"))) > 0 Then
Set cmd = CreateObject("ADODB.Command")
cmd.ActiveConnection = con
cmd.CommandText = "INSERT INTO vocabulary (word, language, english_equiv) VALUES (?,?,?)"
cmd.Parameters.Append cmd.CreateParameter("?", adVarWChar, adParamInput, 255, Request.Form("word"))
cmd.Parameters.Append cmd.CreateParameter("?", adVarWChar, adParamInput, 255, Request.Form("language"))
cmd.Parameters.Append cmd.CreateParameter("?", adVarWChar, adParamInput, 255, Request.Form("english_equiv"))
cmd.Execute
Set cmd = Nothing
End If
%>
<h2>Word list:</h2>
<table border=1>
<tr>
<th>word</th><th>language</th><th>english_equiv</th>
</tr>
<%
Set rst = CreateObject("ADODB.Recordset")
rst.Open _
"SELECT * FROM vocabulary ORDER BY ID", _
con, 3, 3
Do Until rst.EOF
Response.Write "<tr>"
Response.Write "<td>" & rst("word").Value & "</td>"
Response.Write "<td>" & rst("language").Value & "</td>"
Response.Write "<td>" & rst("english_equiv").Value & "</td>"
Response.Write "</tr>"
rst.MoveNext
Loop
Response.Write "</table>"
rst.Close
Set rst = Nothing
con.Close
Set con = Nothing
%>
<h2>Add a new entry:</h2>
<form action="<% Response.Write Request.ServerVariables("SCRIPT_NAME") %>" method="POST">
<table>
<tr>
<td align="right">word:</td>
<td><input type="text" name="word"></td>
</tr>
<tr>
<td align="right">language:</td>
<td><input type="text" name="language"></td>
</tr>
<tr>
<td align="right">english_equiv:</td>
<td><input type="text" name="english_equiv"></td>
</tr>
<tr>
<td></td>
<td align="center"><input type="submit" value="Submit"></td>
</tr>
</table>
</body>
</html>
从 Access 数据库中名为 [vocabulary] 的表开始

当我们加载我们看到的 ASP 页面时

如果我们为俄语单词添加一个新条目

然后单击“提交”页面将刷新

如果我们检查 Access 中的表格,我们会看到

重要的提示
请注意,您不应将 Access 数据库用作 Web 应用程序的后端数据存储;Microsoft强烈建议不要这样做(参考:here)。