[ASP][Function]TransferCode - ASCII To Unicode

轉碼 ASCII轉Unicode

 

'Chg_UNI(字串)  

Function Chg_UNI(str)  
  dim old,new_w,iStr
  old = str
  new_w = ""
  for iStr = 1 to len(str)
      if ascw(mid(old,iStr,1)) < 0 then
    new_w = new_w & "&#" & ascw(mid(old,iStr,1))+65536 & ";"
      elseif    ascw(mid(old,iStr,1))>0 and ascw(mid(old,iStr,1))<127 then
    new_w = new_w & mid(old,iStr,1)
      else
    new_w = new_w & "&#" & ascw(mid(old,iStr,1)) & ";"
      end if
  next
  Chg_UNI=new_w
End Function