(PHP ActiveX) Transition from Crypt2.DecodeString to StringBuilder.Decode
Provides instructions for replacing deprecated DecodeString method calls with StringBuilder.Decode. Note: This example requires Chilkat v11.0.0 or greater.
<?php
$crypt2 = new COM("Chilkat.Crypt2");
// ...
// ...
// ------------------------------------------------------------------------
// The DecodeString method is deprecated:
// The string "Hello World" in base64 (using the utf-8 byte representation) is "SGVsbG8gV29ybGQ="
$encodedStr = 'SGVsbG8gV29ybGQ=';
$encoding = 'base64';
$charset = 'utf-8';
$str = $crypt2->decodeString($encodedStr,$charset,$encoding);
print $str . "\n";
// Output is "Hello World"
// ------------------------------------------------------------------------
// Do the equivalent using StringBuilder.Decode.
$sb = new COM("Chilkat.StringBuilder");
$sb->Append($encodedStr);
$sb->Decode($encoding,$charset);
print $sb->getAsString() . "\n";
// Output is "Hello World"
?>
|