自己来解答:
str0="这是一个utf-8字符串!"
function reg_arr(reg_str,str,ml)
Set re = New RegExp
re.Pattern = reg_str
re.Global = True
re.IgnoreCase = True
re.MultiLine = True
set m=re.execute(str)
dim rtn
dim tmp
redim rtn(m.count-1)
i=0
for each mt in m
mv=mt.value
redim tmp(ml)
for k=1 to ml
par="$"&k
tmp(k-1)=re.replace(mv,par)
next
rtn(i)=tmp
i=i+1
next
reg_arr=rtn
end function
function utf8code2gb(str)
strs=reg_arr("&#(\d+);",str,1)
for i=0 to ubound(strs)
str=replace(str,"&#"&strs(i)(0)&";",chrw(strs(i)(0)))
next
utf8code2gb=str
end function
msgbox(utf8code2gb(str0))