Sample code for 30+ languages & platforms
Objective-C

HTML Encoding

Demonstrates HTML encoding and decoding.

Chilkat Objective-C Downloads

Objective-C
#import <CkoCrypt2.h>
#import <NSString.h>

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

NSString *s = @"< é ü ç Ω Hello & World ✓ >";

NSString *htmlEncoded = [crypt EncodeString: s charset: @"utf-8" encoding: @"html"];
NSLog(@"%@",htmlEncoded);

//  Output:
//  < &eacute; &uuml; &ccedil; &ohm; Hello & World &check; >

//  To decode:
s = [crypt DecodeString: htmlEncoded charset: @"utf-8" encoding: @"html"];
NSLog(@"%@",s);

//  Output:
//  < é ü ç Ω Hello & World ✓ >