Helper functions to encode/decode html entities