Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) Demonstrate the Global.AutoQBDecode property

The Global.AutoQBDecode property can be set to True to cause Q/B encoded string arguments passed to any Chilkat method to be automatically decoded before being used.

Note: This example requires Chilkat v10.0.0 or later.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoGlob
    String sS_cafe
    Handle hoS1
    Boolean iSuccess
    String sS_hello
    Handle hoS2
    String sTemp1

    // Turn on auto Q/B decoding for all strings passed to any Chilkat method in any Chilkat class.
    Get Create (RefClass(cComChilkatGlobal)) To hoGlob
    If (Not(IsComObjectCreated(hoGlob))) Begin
        Send CreateComObject of hoGlob
    End
    Set ComAutoQBDecode Of hoGlob To True

    // ---------------------------------------------------------------------------------------------------------------------------------------------
    // "Q" Encoding

    // Quoted-Printable encoding is primarily used for text that is mostly ASCII with some non-ASCII characters. 
    // It encodes these characters in a way that remains mostly readable and compatible with ASCII-only systems.

    // How It Works with UTF-8:
    // - ASCII characters (except special characters like `=`) are encoded as themselves.
    // - Non-ASCII characters are represented by their UTF-8 byte values, each byte encoded as `=` followed by two hexadecimal digits. 
    //   For example, the UTF-8 character "é" (U+00E9) is encoded as `=C3=A9`.

    // For example, consider the text "Café" encoded in UTF-8. The UTF-8 bytes for "é" are `C3 A9`, so in Quoted-Printable, it looks like this:  Caf=C3=A9

    // The "Q" encoding has this syntax:  "=?charset?q?encoded_text?="
    // For example: "=?UTF-8?Q?Caf=C3=A9_announcement?="

    // ------
    // "B" Encoding

    // Base64 encoding is used to encode non-ASCII text, making it more suitable for text with a high density of non-ASCII characters, such as those found in non-Western European languages.

    // For example, consider the text "こんにちは" ("Hello" in Japanese).
    // The "B" encoded string would be "=?UTF-8?B?44GT44KT44Gr44Gh44Gv?="

    // ------
    // Q encoding is suitable for text that is mostly ASCII.
    // B Encoding is best for text that is densely packed with non-us-ascii chars, such as non-Latin (Asian) languages.
    // ---------------------------------------------------------------------------------------------------------------------------------------------

    // You can use Chilkat's online tool at Online Binary Encoder to pre-encode your literal strings before
    // inserting them into your source code.

    // When using the online tool, choose either "MIME header Q Encoding" or "MIME Header B Encoding".

    // For example:
    Move "=?utf-8?Q?Caf=C3=A9?=" To sS_cafe
    Get Create (RefClass(cComChilkatStringBuilder)) To hoS1
    If (Not(IsComObjectCreated(hoS1))) Begin
        Send CreateComObject of hoS1
    End
    Get ComAppend Of hoS1 sS_cafe To iSuccess
    Get ComGetAsString Of hoS1 To sTemp1
    Showln sTemp1
    // Output is Café

    Move "=?UTF-8?B?44GT44KT44Gr44Gh44Gv?=" To sS_hello
    Get Create (RefClass(cComChilkatStringBuilder)) To hoS2
    If (Not(IsComObjectCreated(hoS2))) Begin
        Send CreateComObject of hoS2
    End
    Get ComAppend Of hoS2 sS_hello To iSuccess
    Get ComGetAsString Of hoS2 To sTemp1
    Showln sTemp1
    // Output is こんにちは


End_Procedure

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.