(AutoIt) MIME Header Q and B Encoding and Decoding
Demonstrates how to Q and B encode/decode.
$oSb = ObjCreate("Chilkat_9_5_0.StringBuilder")
Local $bSuccess
$oSb.Append("This is a test")
ConsoleWrite($oSb.GetEncoded("B","utf-8") & @CRLF)
; output is:
; =?utf-8?B?VGhpcyBpcyBhIHRlc3Q=?=
ConsoleWrite($oSb.GetEncoded("Q","iso-8859-1") & @CRLF)
; output is:
; =?utf-8?Q?This_is_a_test?=
$oSb2 = ObjCreate("Chilkat_9_5_0.StringBuilder")
$oSb2.Append("=?utf-8?B?VGhpcyBpcyBhIHRlc3Q=?=")
$oSb2.Decode("B","utf-8")
ConsoleWrite($oSb2.GetAsString() & @CRLF)
; output is:
; This is a test
$oSb2.Clear
$oSb2.Append("=?utf-8?Q?This_is_a_test?=")
$oSb2.Decode("Q","utf-8")
ConsoleWrite($oSb2.GetAsString() & @CRLF)
; output is:
; This is a test
; "B" or "Q" will decode both B and Q.
$oSb2.Clear
$oSb2.Append("=?utf-8?Q?This_is_a_test?= 123 =?utf-8?B?VGhpcyBpcyBhIHRlc3Q=?=")
$oSb2.Decode("Q","utf-8")
ConsoleWrite($oSb2.GetAsString() & @CRLF)
; output is:
; This is a test 123 This is a test
|