Ruby
Ruby
HTML Entity Encode and Decode in StringBuilder
Demonstrates HTML encoding and decoding the contents of a StringBuilder.Chilkat Ruby Downloads
require 'chilkat'
sb = Chilkat::CkStringBuilder.new()
s = "< é ü ç Ω Hello & World ✓ >"
sb.Append(s)
sb.Encode("html","utf-8")
print sb.getAsString() + "\n";
# Output:
# < é ü ç Ω Hello & World ✓ >
# To decode:
sb.Decode("html","utf-8")
print sb.getAsString() + "\n";
# Output:
# < é ü ç Ω Hello & World ✓ >