Encode special characters into HTML5 named, numeric decimal, or hexadecimal entities, and decode entities back to plain text.