大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> ASP专区 -> asp国标转大五码

asp国标转大五码

时间: 2021-07-31 作者:daque

<% '================================================== '因变量名:gb2big5 '作 用:国家标准码转大五码 '参 数:text ------ 字符串 '作 者:netyum(杨嵩) 'q q: 8025628'时 间:2004年6月28日 '================================================== function gb2big5(text) dim ados,max,i,c,b,h,l if isnull(text) or text = "" then exit function set ados=server.createobject("adodb.stream") ados.mode = 3 ados.type = 1 ados.open ados.loadfromfile(server.mappath("gb-big5.table")) text = server.urlencode(text) b = "" max = len(text) for i=1 to max c = mid(text,i,1) if c = "%" then h = eval("&h"+mid(text,i+1,2)) if h < 128 then b = b & chr(h) i = i+2 else if isvalidhex(mid(text,i,3)) then if isvalidhex(mid(text,i+3,3)) then l = eval("&h"+mid(text,i+4,2)) ados.position = (h-160)*510+(l-1)*2 b = b & bytes2bstr(ados.read(2)) i = i+5 else b = b & " " i = i+3 end if end if end if else if c = "+" then b = b & " " else b = b & c end if end if next set ados = nothing gb2big5 = b end function function isvalidhex(str) isvalidhex=true str=ucase(str) if len(str) <> 3 then isvalidhex = false : exit function if left(str,1) <> "%" then isvalidhex = false : exit function c = mid(str,2,1) if not (((c>="0") and (c<="9")) or ((c>="a") and (c<="z"))) then isvalidhex = false : exit function c = mid(str,3,1) if not (((c>="0") and (c<="9")) or ((c>="a") and (c<="z"))) then isvalidhex = false : exit function end function function bytes2bstr(vin) dim strreturn dim i,thischarcode,nextcharcode strreturn = "" for i = 1 to lenb(vin) thischarcode = ascb(midb(vin,i,1)) if thischarcode < &h80 then strreturn = strreturn & chr(thischarcode) else nextcharcode = ascb(midb(vin,i+1,1)) strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode)) i = i + 1 end if next bytes2bstr = strreturn end function %>

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.