![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C) Transition from Crypt2.DecodeString to StringBuilder.DecodeProvides instructions for replacing deprecated DecodeString method calls with StringBuilder.Decode. Note: This example requires Chilkat v11.0.0 or greater.
#include <C_CkCrypt2W.h> #include <C_CkStringBuilderW.h> void ChilkatSample(void) { HCkCrypt2W crypt2; const wchar_t *encodedStr; const wchar_t *encoding; const wchar_t *charset; const wchar_t *str; HCkStringBuilderW sb; crypt2 = CkCrypt2W_Create(); // ... // ... // ------------------------------------------------------------------------ // The DecodeString method is deprecated: // The string "Hello World" in base64 (using the utf-8 byte representation) is "SGVsbG8gV29ybGQ=" encodedStr = L"SGVsbG8gV29ybGQ="; encoding = L"base64"; charset = L"utf-8"; str = CkCrypt2W_decodeString(crypt2,encodedStr,charset,encoding); wprintf(L"%s\n",str); // Output is "Hello World" // ------------------------------------------------------------------------ // Do the equivalent using StringBuilder.Decode. sb = CkStringBuilderW_Create(); CkStringBuilderW_Append(sb,encodedStr); CkStringBuilderW_Decode(sb,encoding,charset); wprintf(L"%s\n",CkStringBuilderW_getAsString(sb)); // Output is "Hello World" CkCrypt2W_Dispose(crypt2); CkStringBuilderW_Dispose(sb); } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.