我的一片天

我的一片天
posts - 27, comments - 12, trackbacks - 0, articles - 16
   :: 首页 :: 新随笔 :: 联系 ::  :: 管理

2009年5月8日

     摘要: 根据需要把字符串转成二进制,由于汉字无法用ASCB取得正确的内码,需要用Server.URLEncode进行转换。



function strToBin(s)
dim tmpI,tmpR,tmpV,tmpC
tmpR=""
for tmpI=1 to len(s)
tmpC=mid(s,tmpI,1)
tmpv=asc(tmpC)
if tmpV<0 then
tmpC=Server.URLEncode(tmpC)
tmpV=int("&h"&mid(tmpC,2,2))
tmpR=tmpR&chrb(tmpV)

tmpV=int("&h"&mid(tmpC,5,2))
tmpR=tmpR&chrb(tmpV)
else
tmpR=tmpR&chrb(tmpV)
end if
next
strT  阅读全文

posted @ 2009-05-08 11:36 xyz 阅读(640) | 评论 (0)编辑 收藏