Convert text to HTML entities using character mapping
HTML entities are special codes that represent reserved characters in HTML. For example, < represents <, > represents >, and & represents &. Encoding text to entities prevents browsers from interpreting code as HTML, ensuring safe display of user-generated content and code snippets.