Provision interface for mobile MISC1.6 platform (SMS Custom Relationship Synchronization Interface)

Source: Internet
Author: User
<%
Sbase_64_characters = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/"
Sbase_64_characters = Strunicode2ansi (sbase_64_characters)
Function Strunicodelen (ascontents)
' Calculates the length of the ANSI encoding of a Unicode string
Ascontents1= "a" &ascontents
Len1=len (ASCONTENTS1)
K=0
For I=1 to Len1
ASC1=ASC (Mid (ascontents1,i,1))
If Asc1<0 then ASC1=65536+ASC1
If asc1>255 Then
K=k+2
Else
K=k+1
End If
Next
Strunicodelen=k-1
End Function
Function Strunicode2ansi (ascontents)
' Converts a Unicode-encoded string into an ANSI-encoded string
Strunicode2ansi= ""
Len1=len (ascontents)
For I=1 to Len1
Varchar=mid (ascontents,i,1)
VARASC=ASC (varchar)
If Varasc<0 then varasc=varasc+65536
If varasc>255 Then
Varhex=hex (VARASC)
Varlow=left (varhex,2)
Varhigh=right (varhex,2)
Strunicode2ansi=strunicode2ansi & ChrB ("&h" & Varlow) & ChrB ("&h" & Varhigh)
Else
Strunicode2ansi=strunicode2ansi & ChrB (VARASC)
End If
Next
End Function
Function Stransi2unicode (ascontents)
' Converts an ANSI-encoded string into a Unicode-encoded string
Stransi2unicode = ""
Len1=lenb (ascontents)
If Len1=0 then Exit function
For I=1 to Len1
VARCHAR=MIDB (ascontents,i,1)
VARASC=ASCB (varchar)
If VARASC > 127 Then
Stransi2unicode = Stransi2unicode & Chr (AscW (MidB (ascontents,i+1,1) & varchar))
I=i+1
Else
Stransi2unicode = Stransi2unicode & Chr (VARASC)
End If
Next
End Function
Function Base64Encode (ascontents)
' BASE64 encoding an ANSI-encoded string
' Ascontents should be an ANSI-encoded string (the binary string can also)
Dim lnposition
Dim Lsresult
Dim Char1
Dim CHAR2
Dim CHAR3
Dim CHAR4
Dim Byte1
Dim Byte2
Dim Byte3
Dim SaveBits1
Dim SaveBits2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.