Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Re-Encode (How to convert encodings)Demonstrates how to convert a string from one encoding to another. Downloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries FreeBSD C++ Libraries HP-UX C++ Libraries BlackBerry QNX C++ Libraries // Needs #include <CkCrypt2.h> CkString strOut; CkCrypt2 crypt; // Any string argument automatically begins the 30-day trial. bool success; success = crypt.UnlockComponent("30-day trial"); if (success != true) { strOut.append(crypt.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } const char * s1; const char * s2; s1 = "This is a test / = abc 123"; // The ReEncode method converts a string from one encoding // to another. // Valid encodings are "url", "base64", "qp", "hex", and "ansi" // Use "ansi" for an unencoded ANSI string. // Encode to URL-encoding: s2 = crypt.reEncode(s1,"ansi","url"); strOut.append(s2); strOut.append("\r\n"); // Convert from URL-encoding to base64: const char * b64; b64 = crypt.reEncode(s2,"url","base64"); strOut.append(b64); strOut.append("\r\n"); // Convert from base64 to hex: const char * hex; hex = crypt.reEncode(b64,"base64","hex"); strOut.append(hex); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.