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

HTML Entity Encode and Decode in StringBuilder

Demonstrates HTML encoding and decoding the contents of a StringBuilder.

Chilkat B4X Downloads

B4X
Dim sb As ChilkatStringBuilder
sb.Initialize

Dim s As String = "< é ü ç Ω Hello & World ✓ >"
sb.Append(s)

sb.Encode("html", "utf-8")
Log(sb.GetAsString)


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


'  To decode:
sb.Decode("html", "utf-8")
Log(sb.GetAsString)

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