function getUnicodeDecode(EncryptWord,separator)
{
var Unicodes=null;
var ChineseWord=”“;
if(separator=”“) separator=”;“;
Unicodes=EncryptWord.split(separator);
for(var index=0;index<Unicodes.length;index++)
{
var unicode=parseInt(Unicodes[index]);
if(!isNaN(unicode))
ChineseWord=ChineseWord+String.fromCharCode(unicode);
}
return ChineseWord;
}
后台Lotus
Function UnicodeEncode(ByVal ChineseWord As String,ByVal separator As String) As String
Dim Encode As String
if separator=”“ Then separator=”;“
For Index=1 to Len(ChineseWord)
Encode=Encode+Cstr(Uni(Mid(ChineseWord,Index,1)))+separator
Next
UnicodeEncode=Encode
End Function
Function UnicodeDecode(Byval EncryptWord As String,Byval separator As String)As String
Dim Unicodes As Variant
Dim ChineseWord As String
Dim Index As Integer
If separator=”“ Then separator=”;“
Unicodes=Split(EncryptWord,separator)
ChineseWord=”“
For Index=Lbound(Unicodes) To Ubound(Unicodes)
If Isnumeric(Unicodes(Index)) Then ChineseWord=ChineseWord+Ustring(1,CLng(Unicodes(Index)))
Next
UnicodeDecode=ChineseWord
End Function
十六进制方式(字符串略短)
function getUnicodeEncode(ChineseWord,separator)
{
var Encode=”“;
if(separator=”“) separator=”;“;
for(var index=0;index<ChineseWord.length;index++)
{
Encode=Encode+ChineseWord.charCodeAt(index).toString(16)+separator;
}
return Encode;
}
function getUnicodeDecode(EncryptWord,separator)
{
var Unicodes=null;
var ChineseWord=”“;
if(separator=”“) separator=”;“;
Unicodes=EncryptWord.split(separator);
for(var index=0;index<Unicodes.length;index++)
{
var unicode=parseInt(Unicodes[index],16);
if(!isNaN(unicode))
ChineseWord=ChineseWord+String.fromCharCode(unicode);
}
return ChineseWord;
}
后台Lotus
Function UnicodeEncode(ByVal ChineseWord As String,ByVal separator As String) As String
Dim Encode As String
if separator=”“ Then separator=”;“
For Index=1 to Len(ChineseWord)
Encode=Encode+Cstr(Hex(Uni(Mid(ChineseWord,Index,1))))+separator
Next
UnicodeEncode=Encode
End Function
Function UnicodeDecode(Byval EncryptWord As String,Byval separator As String)As String
Dim Unicodes As Variant
Dim ChineseWord As String
Dim Index As Integer
If separator=”“ Then separator=”;“
Unicodes=Split(EncryptWord,separator)
ChineseWord=”“
For Index=Lbound(Unicodes) To Ubound(Unicodes)
ChineseWord=ChineseWord+Ustring(1,getHex(Unicodes(Index)))
Next
UnicodeDecode=ChineseWord
End Function
Function getHex(Byval hexText As String)As Long
Dim index,length As Integer
Dim getValue As Long
Dim HexPiece As String
Dim ReserveHex As String
Dim Pos As Integer
hexText=Trim(hexText)
hexText=Ucase(hexText)
getValue=0
length=Len(hexText)
ReserveHex=”0123456789ABCDEF“
For index=1 To length
HexPiece=Mid(hexText,index,1)
Pos=Instr(1,ReserveHex,HexPiece) ’1~16
If Pos<1 Or Pos>16 Then
getHex=getValue
Exit Function
End If
If getValue>0 Then getValue=getValue*16
getValue=getValue+(Pos-1)
Next
getHex=getValue
End Function