Encoding asp3中的url编码

Encoding asp3中的url编码,encoding,utf-8,asp-classic,Encoding,Utf 8,Asp Classic,如何在asp3中设置url编码 与代码类似 如何传递编码类型?您也可以进行UriEncode,但此功能仅在javascript中存在,但您可以在asp classic中切换语言 <SCRIPT LANGUAGE="JavaScript" RUNAT="Server"> function fnencodeURIComponent(n) { return encodeURIComponent(n) } function fndecodeURIComponent

如何在asp3中设置url编码 与代码类似


如何传递编码类型?

您也可以进行UriEncode,但此功能仅在javascript中存在,但您可以在asp classic中切换语言

<SCRIPT LANGUAGE="JavaScript" RUNAT="Server">
  function fnencodeURIComponent(n)
  {
    return  encodeURIComponent(n)
  }

  function fndecodeURIComponent(n)
  {
    return decodeURIComponent(n)
  }

</SCRIPT>
<% 'normal asp
    url = fnencodeURIComponent(myString)
%>

功能组件(n)
{
返回组件(n)
}
功能组件(n)
{
返回组件(n)
}

只需调用UrlEncode,并作为第二个参数指定编码

net 3中也支持同样的重载,所以您应该很好。

对经典asp.net使用Server.URLEncode(字符串)


你是在问什么?是的。或类似function@Eduardo将此作为答案发布,我认为这也是正确的答案。:)我认为询问者熟悉Server.URLEncode(string)方法。这个问题是关于为url字符串设置不同的编码。ASP.net示例中没有编码类型。那么需要什么“类型”?我认为它通常被转换成十六进制的等价形式。发生了什么,具体是什么调用失败了?邮政编码
<SCRIPT LANGUAGE="JavaScript" RUNAT="Server">
  function fnencodeURIComponent(n)
  {
    return  encodeURIComponent(n)
  }

  function fndecodeURIComponent(n)
  {
    return decodeURIComponent(n)
  }

</SCRIPT>
<% 'normal asp
    url = fnencodeURIComponent(myString)
%>