xxxxxxxxxx
//example of using the html encode object
// set the type of encoding to numerical entities e.g & instead of &
Encoder.EncodeType = "numerical";
// or to set it to encode to html entities e.g & instead of &
Encoder.EncodeType = "entity";
// HTML encode text from an input element
// This will prevent double encoding.
var encoded = Encoder.htmlEncode(document.getElementById('input'));
// To encode but to allow double encoding which means any existing entities such as
// & will be converted to &
var dblEncoded = Encoder.htmlEncode(document.getElementById('input'),true);
// Decode the now encoded text
var decoded = Encoder.htmlDecode(encoded);
// Check whether the text still contains HTML/Numerical entities
var containsEncoded = Encoder.hasEncoded(decoded);
xxxxxxxxxx
import html
encoded_string = "This is an HTML-encoded string: <b>Hello, World!</b>"
decoded_string = html.unescape(encoded_string)
print(decoded_string)