如何把中文转换为UNICODE?
来源:asp之家 发布时间:2009-11-07 18:39:00
把中文字符转换回Unicode字符。
见下列代码:
<%
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 & "'"
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
%>


猜你喜欢
- 问题详情:使用pip install pyecharts 安装的是最新版,本人默认回车后安装1.1.0版本,出现如图问题:解决方法:(推荐第
- 本文实例讲述了vue实现父子组件之间的通信以及兄弟组件的通信功能。分享给大家供大家参考,具体如下:<!DOCTYPE html>
- 字符串函数ASCII(str) 返回字符串str的第一个字符的ASCII值(str是空串时返回0) my
- 前言数据分析时候,需要将数据进行加载和存储,本文主要介绍和excel的交互。read_excel()加载函数为read_excel(),其具
- 首先,啰嗦几句废话如下: (1)触发器(trigger)是个特殊的存储过程,它的执行并不需要我们去显式调用,而是由一些事件触发,这有点类似C
- 问题一:会报错的写法: GRANT ALL PRIVILEGES ON *.* ‘root'@'%
- 1. 训练运行时候指定GPU运行时候加一行代码:CUDA_VISIBLE_DEVICES=1 python train.py2. 运行过程中
- 环境:主服务器:centos 5.2 mysql 5.1.35 源码 IP:192.168.1.22从服务器:centos 5.2 mysq
- 一、matplotlib.pyplot.boxplot()语法boxplot(x, notch=None, sym=None, vert=N
- 解决方案在安装包的路径的../database/state/cvu/cvu_prereq.xml文件尾部添加如下:<OPERATING
- asp抓取网页。偶要实现实实更新天气预报。利用了XMLHTTP组件,抓取网页的指定部分。很多小偷查询都是使用这个方法来实现的。需要分件htm
- 检测自己当前系统环境中python是否已经安装该module,若未安装请自行安装检测自己的pycharm使用的环境变量是否与当前环境一致若不
- python生成随机数都有哪些办法呢使用 random 模块:random模块是python内置的模块,使用方法如random.randin
- 无论安装何版本的mysql,在管理工具的服务中启动mysql服务时都会在中途报错。内容为:在 本地计算机 无法启动mysql服务 错误106
- 我用 ip=Request.ServerVariables ("
- 常规方案使用FileReader以utf-8格式读取文件,根据文件内容是否包含乱码字符�,来判断文件是否为utf-8。如果存在�,即文件编码
- 数组去重复和数组排序'数组名次 Function Sort(ary,stra) KeepChecking =&n
- 前言:IPython 是 Python 的原生交互式 shell 的增强版,可以完成许多不同寻常的任务,比如帮助实现并行化计算;主要使用它提
- 如下所示:data = { "北京":{ "昌平":{"沙河":[&
- 由于工作对人的眼球和精神都会带来一定的疲劳,所以在界面设计中,希望用户能够准确的关注重要的信息,而不因为用户的长期使用而流失信息。最近在看《