壹次网首页 | 工具源码首页 | 技术文章首页 | 文章分类 | | |

文章搜索: 分类 关键字
您的位置:首页网络编程ASP/shtml → asp把中文转换为UNICODE
asp把中文转换为UNICODE
添加日期:2007-6-11 3:38:10     [ ]
见下列代码:

<%
function unicode(str)
dim i,j,c,i1,i2,u,fs,f,p
unicode=""
p=""
for i=1 to len(str)
c=mid(str,i,1)
j=ascw(c)
if j<0 then
j=j+65536
end if
if j>=0 and j<=128 then
if p="c" then
unicode=" "&unicode
p="e"
end if
unicode=unicode&c
else
if p="e" then
unicode=unicode&" "
p="c"
end if
unicode=unicode&"&#"&j&";"
end if
next
end function

function cutline(str,linelen)
dim i,j,c,k
cutline=""
j=0
for i=1 to len(str)
c=mid(str,i,1)
if asc(c)<0 or asc(c)>127 then
k=2
else
if asc(c)<32 then
k=0
if asc(c)=13 then
j=0
cutline=cutline+"<br/>"+c
c=""
end if
else
k=1
end if
end if
j=j+k
if j>linelen*2 then
cutline=cutline+"<br/>"+vbCrlf+c
j=k
else
cutline=cutline+c
end if
next
end function

function convertsymbol(sStr)
dim i,c
convertsymbol=""
for i=1 to len(sStr)
c=mid(sStr,i,1)
if c=">" then
convertsymbol=convertsymbol & ">"
elseif c="<" then
convertsymbol=convertsymbol & "<"
elseif c="’" then
convertsymbol=convertsymbol & "&apos;"
elseif c="""" then
convertsymbol=convertsymbol & """
elseif c="&" then
convertsymbol=convertsymbol & "&"
elseif c="$" then
convertsymbol=convertsymbol & "$$"
else
convertsymbol=convertsymbol & c
end if
next
end function

function convertstring(sStr)
dim strtemp,asctemp,c
strtemp=""
for i=1 to len(sStr)
c=mid(sStr,i,1)
asctemp=ascw(c)
if (asctemp>47 and asctemp<58) or (asctemp>64 and asctemp<91) or (asctemp>96 and asctemp<123) then
strtemp=strtemp & c
end if
next
convertstring=Lcase(strtemp)
end function
%>
出处:论坛转载 作者:佚名 点击:
 相关文章
·UTF-8 and Unicode FAQ
 热点文章
·photoshop制作香烟、烟头、烟雾
·photoshop图片卷角、翻页效果的制作
·用U盘或移动硬盘装《深山红叶袖珍系统Win PE启动..
·photoshop经典恐怖片海报效果教程
·photoshop水晶球质感表现 - 关于光影的细节
·ghost.pif最新变种手动查杀,ARP欺骗挂马+KAV让..
·[css] table-layout:fixed 属性的解说,IE、Fire..
·photoshop制作3D立体小人和字体
·关于zend解密的程序
·自适应页面高度100%方法(表格直接100%高度没有效..
 推荐文章
·如何彻底删除一个不需要的系统服务
·模仿QQ和MSN消息提示的效果
·CC攻击的思路及防范方法
·广告联盟的一些评价
Powered by yici.net
CopyRight (C) 2006-2012 版权所有   [ 依次网 ];未经授权,任何人不得抄袭、仿冒本站
ICP备案:苏ICP备05011771号 证书下载 ICP证号:苏ICP证040301
仪征广目网络信息服务有限公司 版权所有