; c4 = base64DecodeChars(c4)
End If
Loop While (i < len1 And c4 = -1)
If (c4 = -1) Then
base64decode = out
Exit Function
End If
out = out + Chr(((c3 And 3) * 64) Or c4)
Wend
base64decode = out
End Function
Function utf16to8(str As String) As String
Dim out, i, len1, c
out = ""
len1 = Len(str)
For i = 1 To len1
c = Asc(Mid(str, i, 1))
If ((c >= 1) And (c <= 127)) Then
out = out + Mid(str, i, 1)
ElseIf (c > 2047) Then
out = out + Chr(224 Or ((c \ 4096) And 15))
out = out + Chr(128 Or ((c \ 64) And 63))
out = out + Chr(128 Or (c And 63))
Else
out = out + Chr(192 Or ((c \ 64) And 31))
out = out + Chr(128 Or (c And 63))
End If
Next
utf16to8 = out
End Function
Function utf8to16(str As String) As String
Dim out, i, len1, c
Dim char2, char3
out = ""
len1 = Len(str)
i = 0
While (i < len1)
c = Asc(Mid(str, i + 1, 1))
i = i + 1
Select Case (c \ 16)
Case 0 To 7
out = out + Mid(str, i, 1)
Case 12, 13
char2 = Asc(Mid(str, i + 1, 1))
i = i + 1
out = out