Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.1.0+

HTML Entity Encode and Decode in StringBuilder

Demonstrates HTML encoding and decoding the contents of a StringBuilder.

Chilkat Xbase++ Downloads

Xbase++
LOCAL oSb
LOCAL s

oSb := CreateObject("Chilkat.StringBuilder")

s := "< é ü ç Ω Hello & World ✓ >"
oSb:Append(s)

oSb:Encode("html", "utf-8")
? oSb:GetAsString()

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

//  To decode:
oSb:Decode("html", "utf-8")
? oSb:GetAsString()

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

oSb:destroy()