Function EscapeCode(p_Message)
Dim m_char,m_asc,m_hex
Dim m_temp
Dim a_arc()
Dim i
ReDim a_arc(Len(p_Message))
For i = 0 To Len(p_Message) -1
m_char = Mid(p_Message,i+1,1)
m_asc = AscW(m_char)
If m_asc < 255 Then
If (m_char = "*") Or(m_char = "+") _
Or(m_char >= "-" And m_char <= "9" ) _
Or(m_char >= "@" And m_char <= "Z" ) _
Or(m_char = "_") _
Or(m_char >= "a" And m_char <= "z" ) Then
a_arc(i) = m_char
Else
m_temp = Hex(m_asc)
If Len(m_temp) = 1 Then
a_arc(i) = "%0" & m_temp
ElseIf Len(m_temp) = 2 Then
a_arc(i) = "%" & m_temp
Else
a_arc(i) = "%u" & m_temp
End If
End If
Else
m_temp = Hex(m_asc)
If Len(m_temp) = 1 Then
a_arc(i) = "%u000" & m_temp
ElseIf Len(m_temp) = 2 Then
a_arc(i) = "%u00" & m_temp
ElseIf Len(m_temp) = 3 Then
a_arc(i) = "%u0" & m_temp
Else
a_arc(i) = "%u" & m_temp
End If
End If
Next
EscapeCode = Join(a_arc,"")
End Function
No comments:
Post a Comment