1. 聚禄鼎_一站式企业服务平台!首页
  2. 托运须知

ps网课一般多少钱,ps网课推荐

unicode变换字符串?

ps网课一般多少钱,ps网课推荐

asp中unicode字符串转换为base64编码

<%

sBASE_64_CHARACTERS = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/” sBASE_64_CHARACTERS = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/”

sBASE_64_CHARACTERS = strUnicode2Ansi(sBASE_64_CHARACTERS) sBASE_64_CHARACTERS = strUnicode2Ansi(sBASE_64_CHARACTERS)

Function strUnicodeLen(asContents) Function strUnicodeLen(asContents)

’在unicode字符串中计算Ansi编码长度

asContents1=”a”&asContents asContents1=”a”&asContents

len1=len(asContents1) len1=len(asContents1)

k=0 k=0

in the case of i=1 through len1

asc1=asc(mid(asContents1,i,1)) asc1=asc(mid(asContents1,i,1))

if asc1<0 then asc1=65536+asc1 if asc1<0 then asc1=65536+asc1

if asc1>255 then

k=k+2 k=k+2

otherwise

k=k+1 k=k+1

finish if

next

strUnicodeLen=k-1 strUnicodeLen=k-1

End Function End Function

Function strUnicode2Ansi(asContents) Function strUnicode2Ansi(asContents)

’把Unicode编码字符串转换为Ansi

strUnicode2Ansi=”” strUnicode2Ansi=””

len1=len(asContents) len1=len(asContents)

in the case of i=1 through len1

varchar=mid(asContents,i,1) varchar=mid(asContents,i,1)

varasc=asc(varchar) varasc=asc(varchar)

if varasc<0 then varasc=varasc+65536 if varasc<0 then varasc=varasc+65536

if varasc>255 then

varHex=Hex(varasc) varHex=Hex(varasc)

varlow=left(varHex,2) varlow=left(varHex,2)

varhigh=right(varHex,2) varhigh=right(varHex,2)

strUnicode2Ansi=strUnicode2Ansi & chrb(“&H” & varlow ) & chrb(“&H” & varhigh ) strUnicode2Ansi=strUnicode2Ansi & chrb(“&H” & varlow ) & chrb(“&H” & varhigh )

otherwise

strUnicode2Ansi=strUnicode2Ansi & chrb(varasc) strUnicode2Ansi=strUnicode2Ansi & chrb(varasc)

finish if

next

Final function

Function strAnsi2Unicode(asContents) Function strAnsi2Unicode(asContents)

’把Ansi编码字符串转换为Unicode

strAnsi2Unicode = “” strAnsi2Unicode = “”

len1=lenb(asContents) len1=lenb(asContents)

if len1=0 then the output function

in the case of i=1 through len1

varchar=midb(asContents,i,1) varchar=midb(asContents,i,1)

varasc=ascb(varchar) varasc=ascb(varchar)

if varasc > 127 at that time

strAnsi2Unicode = strAnsi2Unicode & chr(ascw(midb(asContents,i+1,1) & varchar)) strAnsi2Unicode = strAnsi2Unicode & chr(ascw(midb(asContents,i+1,1) & varchar))

i=i+1 i=i+1

otherwise

strAnsi2Unicode = strAnsi2Unicode & chr(varasc) strAnsi2Unicode = strAnsi2Unicode & chr(varasc)

finish if

next

Final function

Function Base64encode(asContents) Function Base64encode(asContents)

’把Ansi编码字符串编码为Base64

‘asContents应当是ANSI编码的字符串(二进制的字符串也可以)

Dim lnPosition Dim lnPosition

Dim lsResult Dim lsResult

Dim Char1 Dim Char1

Dim Char2 Dim Char2

Dim Char3 Dim Char3

Dim Char4 Dim Char4

Dim Byte1 Dim Byte1

Dim Byte2 Dim Byte2

Dim Byte3 Dim Byte3

Dim SaveBits1 Dim SaveBits1

Dim SaveBits2 Dim SaveBits2

Dim lsGroupBinary Dim lsGroupBinary

Dim lsGroup64 Dim lsGroup64

Dim m4,len1,len2 Dim m4,len1,len2

len1=Lenb(asContents) len1=Lenb(asContents)

for example, if len1<1

Base64encode=”” Base64encode=””

exit Function exit Function

finish if

m3=Len1 Mod-3

If M3 > 0 Then asContents = asContents & String(3-M3, chrb(0)) If M3 > 0 Then asContents = asContents & String(3-M3, chrb(0))

’补足位数的目的在于方便运算

IF m3 > 0 THEN IF m3 > 0 THEN

len1=len1+(3-m3) len1=len1+(3-m3)

len2=len1-3 len2=len1-3

otherwise

len2=len1 len2=len1

finish if

lsResult = “”

In the case of lnPosition = 1 À len2 Step 3

lsGroup64 = “” lsGroup64 = “”

lsGroupBinary = Midb(asContents, lnPosition, 3) lsGroupBinary = Midb(asContents, lnPosition, 3)

Byte1 = Ascb(Midb(lsGroupBinary, 1, 1)): SaveBits1 = Byte1 And 3 Byte1 = Ascb(Midb(lsGroupBinary, 1, 1)): SaveBits1 = Byte1 And 3

Byte2 = Ascb(Midb(lsGroupBinary, 2, 1)): SaveBits2 = Byte2 And 15 Byte2 = Ascb(Midb(lsGroupBinary, 2, 1)): SaveBits2 = Byte2 And 15

Byte3 = Ascb(Midb(lsGroupBinary, 3, 1)) Byte3 = Ascb(Midb(lsGroupBinary, 3, 1))

Char1 = Midb(sBASE_64_CHARACTERS, ((Byte1 And 252) \ 4) + 1, 1) Char1 = Midb(sBASE_64_CHARACTERS, ((Byte1 And 252) \ 4) + 1, 1)

Char2 = Midb(sBASE_64_CHARACTERS, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1) Char2 = Midb(sBASE_64_CHARACTERS, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1)

Char3 = Midb(sBASE_64_CHARACTERS, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1) Char3 = Midb(sBASE_64_CHARACTERS, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1)

Char4 = Midb(sBASE_64_CHARACTERS, (Byte3 And 63) + 1, 1) Char4 = Midb(sBASE_64_CHARACTERS, (Byte3 And 63) + 1, 1)

lsGroup64 = Char1 & Char2 & Char3 & Char4 lsGroup64 = Char1 & Char2 & Char3 & Char4

lsResult = lsResult & lsGroup64 lsResult = lsResult & lsGroup64

Next

’处理后剩下的一些字符

if M3 > 0 then, in this case

lsGroup64 = “” lsGroup64 = “”

lsGroupBinary = Midb(asContents, len2+1, 3) lsGroupBinary = Midb(asContents, len2+1, 3)

Byte1 = Ascb(Midb(lsGroupBinary, 1, 1)): SaveBits1 = Byte1 And 3 Byte1 = Ascb(Midb(lsGroupBinary, 1, 1)): SaveBits1 = Byte1 And 3

Byte2 = Ascb(Midb(lsGroupBinary, 2, 1)): SaveBits2 = Byte2 And 15 Byte2 = Ascb(Midb(lsGroupBinary, 2, 1)): SaveBits2 = Byte2 And 15

Byte3 = Ascb(Midb(lsGroupBinary, 3, 1)) Byte3 = Ascb(Midb(lsGroupBinary, 3, 1))

Char1 = Midb(sBASE_64_CHARACTERS, ((Byte1 And 252) \ 4) + 1, 1) Char1 = Midb(sBASE_64_CHARACTERS, ((Byte1 And 252) \ 4) + 1, 1)

Char2 = Midb(sBASE_64_CHARACTERS, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1) Char2 = Midb(sBASE_64_CHARACTERS, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1)

Char3 = Midb(sBASE_64_CHARACTERS, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1) Char3 = Midb(sBASE_64_CHARACTERS, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1)

if M3=1 then

lsGroup64 = Char1 & Char2 & ChrB(61) & ChrB(61) ‘用=号补足位数 lsGroup64 = Char1 & Char2 & ChrB(61) & ChrB(61) ‘用=号补足位数

otherwise

lsGroup64 = Char1 & Char2 & Char3 & ChrB(61) ‘用=号补足位数 lsGroup64 = Char1 & Char2 & Char3 & ChrB(61) ‘用=号补足位数

finish if

lsResult = lsResult & lsGroup64 lsResult = lsResult & lsGroup64

finish if

Base64encode = lsResult Base64encode = lsResult

End Function End Function

Function Base64decode(asContents) Function Base64decode(asContents)

’把Base64编码字符串变成Ansi编码

‘asContents应当也是ANSI编码的字符串(二进制的字符串也可以)

Dim lsResult Dim lsResult

Dim lnPosition Dim lnPosition

Dim lsGroup64, lsGroupBinary Dim lsGroup64, lsGroupBinary

Dim Char1, Char2, Char3, Char4 Dim Char1, Char2, Char3, Char4

Dim Byte1, Byte2, Byte3 Dim Byte1, Byte2, Byte3

Dim M4,len1,len2 Dim M4,len1,len2

len1= Lenb(asContents) len1= Lenb(asContents)

M4 = len1 Mod-4

then either len1 < 1 or M4 > 0

’字符串的长度应等于4倍

Base64decode = “” Base64decode = “”

exit Function exit Function

finish if

’判断末位是否等于号码

’判断倒数第二是否等于号码

’在此,m4指示了最后剩下的要分别处理的字符数目

if midb(asContents, len1, 1) = chrb(61) then m4=3 if midb(asContents, len1, 1) = chrb(61) then m4=3

if midb(asContents, len1-1, 1) = chrb(61) then m4=2 if midb(asContents, len1-1, 1) = chrb(61) then m4=2

thus, if m4 = 0

len2=len1 len2=len1

otherwise

len2=len1-4 len2=len1-4

finish if

For lnPosition = 1 To Len2 Step 4 For lnPosition = 1 To Len2 Step 4

lsGroupBinary = “” lsGroupBinary = “”

lsGroup64 = Midb(asContents, lnPosition, 4) lsGroup64 = Midb(asContents, lnPosition, 4)

Char1 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 1, 1)) – 1 Char1 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 1, 1)) – 1

Char2 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 2, 1)) – 1 Char2 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 2, 1)) – 1

Char3 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 3, 1)) – 1 Char3 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 3, 1)) – 1

Char4 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 4, 1)) – 1 Char4 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 4, 1)) – 1

Byte1 = Chrb(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF) Byte1 = Chrb(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF)

Byte2 = lsGroupBinary & Chrb(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF) Byte2 = lsGroupBinary & Chrb(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF)

Byte3 = Chrb((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63)) Byte3 = Chrb((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))

lsGroupBinary = Byte1 & Byte2 & Byte3 lsGroupBinary = Byte1 & Byte2 & Byte3

lsResult = lsResult & lsGroupBinary lsResult = lsResult & lsGroupBinary

Next

’处理后剩下的一些字符

if M4 > 0 then it follows that

lsGroupBinary = “” lsGroupBinary = “”

lsGroup64 = Midb(asContents, len2+1, m4) & chrB(65) ‘chr(65)=A,转换成值为0 lsGroup64 = Midb(asContents, len2+1, m4) & chrB(65) ‘chr(65)=A,转换成值为0

if M4=2 then’补足四位是为方便计算

lsGroup64 = lsGroup64 & chrB(65) lsGroup64 = lsGroup64 & chrB(65)

finish if

Char1 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 1, 1)) – 1 Char1 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 1, 1)) – 1

Char2 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 2, 1)) – 1 Char2 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 2, 1)) – 1

Char3 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 3, 1)) – 1 Char3 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 3, 1)) – 1

Char4 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 4, 1)) – 1 Char4 = InStrb(sBASE_64_CHARACTERS, Midb(lsGroup64, 4, 1)) – 1

Byte1 = Chrb(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF) Byte1 = Chrb(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF)

Byte2 = lsGroupBinary & Chrb(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF) Byte2 = lsGroupBinary & Chrb(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF)

Byte3 = Chrb((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63)) Byte3 = Chrb((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))

if M4=2 then

lsGroupBinary = Byte1 lsGroupBinary = Byte1

elseif M4=3 then elseif M4=3 then

lsGroupBinary = Byte1 & Byte2 lsGroupBinary = Byte1 & Byte2

finish if

lsResult = lsResult & lsGroupBinary lsResult = lsResult & lsGroupBinary

finish if

Base64decode = lsResult Base64decode = lsResult

End Function End Function

%>

ps网课一般多少钱,ps网课推荐

Unicode的编码转换

ps网课一般多少钱,ps网课推荐

20 90 A6 68 7F 89 38 6E 33 00

怎样把unicode编码变成一般utf-8或ISO编码

ps网课一般多少钱,ps网课推荐

在UTF-8字符集中直接打开Unicode文字或者图形符号就可以了,因为UTF-8的字符来源于Unicode,只不过它的字符数很少。如果要把它全部删除则需要重新制作一个新的字体,但又无法在网上下载。对UTF-8中无法显示的字符,必须一一做成图片格式,以便更换,修改。由于汉字库中没有这种类型的文字编辑工具,所以我们只能采用手工方式对文本内容进行处理。有的自动处理软件把繁体字或者日韩汉字,异体字等自动换成简体汉字,用这种方法代替的文句似乎不伦不类、不合标准。

数字如何转到UNICODE码?

ps网课一般多少钱,ps网课推荐

原创文章,作者:聚禄鼎,如若转载,请注明出处:https://www.xxso.cn/894.html

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注