时间:2021-05-28
复制代码 代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Session.CodePage=65001%>
<!--#include file="base64.asp"-->
<%
Function AspUrlDecode(strValue)
Dim varAry, varElement, objStream, lngLoop, Flag
strValue = Replace(strValue, "+", " ")
varAry = Split(strValue, "%")
Flag = varAry(0) = ""
Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
.Type = 2
.Mode = 3
.Open
For Each varElement In varAry
If varElement <> Empty Then
If Len(varElement) >= 2 And Flag Then
.WriteText ChrB(CInt("&H" & Left(varElement, 2)))
For lngLoop = 3 To Len(varElement)
.WriteText ChrB(Asc(Mid(varElement, lngLoop, 1)))
Next
Else
For lngLoop = 1 To Len(varElement)
.WriteText ChrB(Asc(Mid(varElement, lngLoop, 1)))
Next
Flag = True
End If
End If
Next
.WriteText Chr(0)
.Position = 0
AspUrlDecode = Replace(ConvUnicode(.ReadText), Chr(0), "", 1, -1, 0)
On Error Resume Next
.Close
Set objStream = Nothing
End With
End Function
Function ConvUnicode(ByVal strData)
Dim rs, stm, bytAry, intLen
If Len(strData & "") > 0 Then
strData = MidB(strData, 1)
intLen = LenB(strData)
Set rs = Server.CreateObject("ADODB.Recordset")
Set stm = Server.CreateObject("ADODB.Stream")
With rs
.Fields.Append "X", 205, intLen
.Open
.AddNew
rs(0).AppendChunk strData & ChrB(0)
.Update
bytAry = rs(0).GetChunk(intLen)
End With
With stm
.Type = 1
.Open
.Write bytAry
.Position = 0
.Type = 2
.Charset = "utf-8"
ConvUnicode = .ReadText
End With
End If
On Error Resume Next
stm.Close
Set stm = Nothing
rs.Close
Set rs = Nothing
End Function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<%
'base64编码后,比起.net多了77u/
Response.Write("base64编码后:"&base64Encode("阿会楠")&"<br />")
'base64解码后
Response.Write("base64解码后:"&base64uncode("6Zi/5Lya5qWg")&"<br />")
%>
</body>
</html>
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
Python中进行Base64编码和解码要用base64模块,代码示例:#-*-coding:utf-8-*-importbase64str='cnblogs'
Js实现Base64编码与解码Base64其实是一种简单的置换加密方式,但是BASE64的用处往往并不是为了防止信息泄露,而且为了方便传输,进过BASE64编码
java图片转base64字符串、base64字符串转图片,具体内容如下1.图片转base64字符串:/***base64编码字符串转换为图片*@paramim
先来说一下为什么我们要对图片base64编码base64是当前网络上最为常见的传输8Bit字节代码的编码方式其中之一。base64主要不是加密,它主要的用途是把
1、base64加密 在页面中引入base64.js文件,调用方法为:base64加密varb=newBase64();varstr=b.encode("ad