[EMAIL PROTECTED] wrote:
In signForm.vbs:Function UTF16toUTF8ByteArray(strUTF16) Dim i, UTF16, UTF8 Dim aryTmp, strTmp For i=1 To Len(strUTF16) UTF16 = AscW(Mid(strUTF16, i, 1)) aryTmp = ToUTF8(UTF16) For Each strTmp In aryTmp If Len(Hex(strTmp)) > 1 Then UTF8 = UTF8 & Hex(strTmp) Else UTF8 = UTF8 & "0" & Hex(strTmp) End If Next Next Dim CapicomUtil Set CapicomUtil = CreateObject("CAPICOM.Utilities") UTF16toUTF8ByteArray = CapicomUtil.HexToBinary(UTF8) End Function Function ToUTF8(ByVal UTF16) ' Convert a 16bit UTF-16BE to 2 or 3 UTF-8 bytes Dim BArray() If UTF16 < &H80 Then ReDim BArray(0) ' one byte UTF-8 BArray(0) = UTF16 ' Use number as Is Elseif UTF16 < &H800 Then ReDim BArray(1) ' two byte UTF-8 BArray(1) = &H80 + (UTF16 And &H3F) ' Least Significant 6 bits UTF16 = UTF16 \ &H40 ' Shift UTF16 number right 6 bits BArray(0) = &HC0 + (UTF16 And &H1F) ' Use 5 remaining bits Else ReDim BArray(2) ' three byte UTF-8 BArray(2) = &H80 + (UTF16 And &H3F) ' Least Significant 6 bits UTF16 = UTF16 \ &H40 ' Shift UTF16 number right 6 bits BArray(1) = &H80 + (UTF16 And &H3F) ' Use next 6 bits UTF16 = UTF16 \ &H40 ' Shift UTF16 number right 6 bits again BArray(0) = &HE0 + (UTF16 And &HF) ' Use 4 remaining bits End If ToUTF8 = BArray ' Return UTF-8 bytes in an Array End Function Function signFormIE(theForm, theWindow) ... SignedData.Content = UTF16toUTF8ByteArray(theForm.text.value) ... End Function
I will add it. It does not look like the the copyright is a problem. Michael -- _______________________________________________________________ Michael Bell Humboldt-Universitaet zu Berlin Tel.: +49 (0)30-2093 2482 ZE Computer- und Medienservice Fax: +49 (0)30-2093 2704 Unter den Linden 6 [EMAIL PROTECTED] D-10099 Berlin _______________________________________________________________
smime.p7s
Description: S/MIME Cryptographic Signature