Added HTML entity encoding and decoding