ASP中URLdecode

 
Public Function URLDecode(ByVal data, ByVal charset)
  Dim strm
  Set strm = Server.CreateObject("ADODB.Stream")
  With strm
  .type = 2
  .charset = "iso-8859-1"
  .open
  .writeText unescape(data)
  .position = 0
  .charset = charset
  URLDecode = .readText(-1)
  .close
  End With
  Set strm = Nothing
End Function

Response.Write URLDecode("%B4%F3%BC%D2%BA%C3%B0%A1", "GB2312") & "<br/>"
Response.Write URLDecode("%E5%A4%A7%E5%AE%B6%E5%A5%BD%E5%95%8A", "UTF-8") & "<br/>" 
Response.Write URLDecode("http%3A%2F%2Fwww.dangdang.com%2F", "UTF-8") & "<br/>" 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章