Cocoa Objective-C Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CUnicode C++Unicode CMFCDelphi DLLDelphi ActiveXFoxProJavaPerlPHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Objective-C Examples

Bounced Email
Digital Certificates
Digital Signatures
DKIM / DomainKey
DSA
Email Object
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
POP3
RSA
MIME
SMTP
Socket
SOCKS Proxy
Spider
SSH Key
SSH
SFTP
Tar
Upload
XML
XMP
Zip


More Examples...
Amazon S3
NTLM
RSS
Atom
PPMD
Deflate
Bzip2
LZW
Diffie-Hellman
Bz2
Character Encoding
CSV

 

 

 

 

 

 

 

 

Quoted-Printable Encode/Decode a String

Objective-C example to quoted-printable encode and decode a string.

Download: Chilkat Cocoa Objective-C Libraries

NSMutableString *strOutput = [NSMutableString stringWithCapacity:1000];

CkoCrypt2 *crypt = [[[CkoCrypt2 alloc] init] autorelease];

//  Any string argument automatically begins the 30-day trial.
BOOL success;
success = [crypt UnlockComponent: @"30-day trial"];
if (success != YES) {
    [strOutput appendString: crypt.LastErrorText];
    [strOutput appendString: @"\n"];
    self.mainTextField.stringValue = strOutput;
    return;
}

//  Here's a string in Icelandic using non us-ascii chars:
NSString *s;
s = @"Ég get etið gler án þess að meiða mig.";

crypt.CryptAlgorithm = @"none";
crypt.EncodingMode = @"quoted-printable";

//  Quoted-printable encode/decode the iso-8859-1
//  representation of the string.  Notice how each
//  Icelandic char is represented by 1 byte:
crypt.Charset = @"iso-8859-1";
NSString *qp;
qp = [crypt EncryptStringENC: s];
[strOutput appendString: @"iso-8859-1:"];
[strOutput appendString: @"\n"];
[strOutput appendString: qp];
[strOutput appendString: @"\n"];
NSString *decoded;
decoded = [crypt DecryptStringENC: qp];
[strOutput appendString: decoded];
[strOutput appendString: @"\n"];

//  Now do the same using utf-8. Notice how each
//  Icelandic char is represented by 2 bytes in utf-8:
crypt.Charset = @"utf-8";

qp = [crypt EncryptStringENC: s];
[strOutput appendString: @"utf-8:"];
[strOutput appendString: @"\n"];
[strOutput appendString: qp];
[strOutput appendString: @"\n"];

decoded = [crypt DecryptStringENC: qp];
[strOutput appendString: decoded];
[strOutput appendString: @"\n"];

self.mainTextField.stringValue = strOutput;



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