服务器端编的话,如果页面使用 UTF-8, 则直接 Server.URLEncode(…) 就是了.
不是的话
<%@ language=“VBScript” codepage=“936” %>
<%
Function encodeURIComponent(str)
Dim oCode : oCode = Response.CodePage
Response.CodePage = 65001
encodeURIComponent = Server.URLEncode(str)
Response.CodePage = oCode
End Function
Response.Write encodeURIComponent(“上海”)
%>