IIS:
在Internet服务管理器上点右键,属性,MIME类型,更改
在单个站点上点右键,属性,HTTP头,MIME类型
添加如下MIME类型
wml text/vnd.wap.wml
wmlc application/vnd.wap.wmlc
wbmp image/vnd.wap.wbmp
wmlsc application/vnd.wap.wmlscriptc
wmls text/vnd.wap.wmlscript
wsc application/vnd.wap.wmlscriptc
重启IIS服务
APACHE:
修改mime.types文件,按文档格式添加如上类型,重启APACHE
将下面的文件保存为UTF-8编码的文件(存为UTF-8就不需要函数c2u来转,文件名为1.asp,放在网站根目录下,然后通过手机访问该文件
<%@ LANGUAGE="VBScript" CODEPAGE="65001" %>
<% Option Explicit
On Error Resume Next
Response.Buffer = True
'***************************************************
'函数:c2u
'作用: 把文字变成unicode
' 如中文:为中文 16进制
'***************************************************
Function c2u(tmpStr)
Dim i
Dim tmpChar
Dim strUnicode
If tmpStr="" Then
c2u=""
Exit Function
End If
For i=1 to Len(tmpStr)
tmpChar=Mid(tmpStr,i,1)
strUnicode=strUnicode&Chr(38) '&
strUnicode=strUnicode&Chr(35) '#
strUnicode=strUnicode&Chr(120) 'x
strUnicode=strUnicode& Hex(ascw(tmpChar))
strUnicode=strUnicode&Chr(59) ';
Next
c2u=strUnicode
End Function
'MIME类型
Response.Charset = "UTF-8"
Response.ContentType = "text/vnd.wap.wml"
%>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head>
<meta forua="true" http-equiv="Cache-Control" content="max-age=0" />
</head>
<card id="MainMenu" title="頭部">
<p><img src="a.gif" alt="a" /><a href="en.asp">English</a></p>
<p><a href="#MainBody">中文</a></p>
<p><a href="#Search">搜索</a></p>
</card>
<card id="MainBody" title="中间部分">
<p><a href="#MainMenu">中文繁體</a></p>
</card>
<card id="Search" title="WAP中文字符传递">
<p>
欢迎使用中文WAP搜索<br/>
请输入关键词: <input name="KeyWord" type="text" value="手机" />
<br/>
<do type="accept" label="查询">
<go href="Search.asp" method="post" accept-charset="gb2312">
<postfield name="KeyWord" value="$(KeyWord)" />
</go>
</do>
<br />
<a href="#MainMenu">返回</a>
</p>
</card>
</wml>