Sample code for 30+ languages & platforms
Objective-C

HTML Entity Encode and Decode in StringBuilder

Demonstrates HTML encoding and decoding the contents of a StringBuilder.

Chilkat Objective-C Downloads

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

CkoStringBuilder *sb = [[CkoStringBuilder alloc] init];

NSString *s = @"< é ü ç Ω Hello & World ✓ >";
[sb Append: s];

[sb Encode: @"html" charset: @"utf-8"];
NSLog(@"%@",[sb GetAsString]);

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

//  To decode:
[sb Decode: @"html" charset: @"utf-8"];
NSLog(@"%@",[sb GetAsString]);

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