Vbscript Asp unicode编码转汉字

 自己写的代码:

ASP/Visual Basic代码
  1. Function unicodetostr(text)  
  2.     unicodetostr=text  
  3.     if instr(text,"&#")>0 then  
  4.         str=split(text,"&#")  
  5.         for i=1 to ubound(str)  
  6.         str1=mid(str(i),1,instr(str(i),";")-1)  
  7.         'response.write(str1&"<br/>")  
  8.         unicodetostr=replace(unicodetostr,"&#"&str1&";",chrw(str1))  
  9.         next  
  10.     end if  
  11. end function  

参考资料:https://zhidao.baidu.com/question/41686234.html

用Chr()函数把ascii码转化成汉字
用ChrW()函数把Unicode码转化成汉字
(还有之前说的AscW()函数返回值为负的时候,应加上65536 才得到汉字实际的Unicode码)
求汉字的Unicode代码 用AscW()函数
AscW("汉")=27721
求汉字的ASCII码 用Asc()函数 返回一个负数值
如Asc("汉")=-17734


上一篇: 记录一次Centos磁盘空间占满的解决办法
下一篇: mysql改变字符串的大小写转换
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: asp vb
相关日志:
评论: 0 | 引用: 0 | 查看次数: 386
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 邮件地址支持Gravatar头像,邮箱地址不会公开.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭

 广告位

↑返回顶部↑