Encode and decode HTML entities. Prevent XSS and display special characters safely.
HTML entities are special codes that represent characters which have special meaning in HTML. The most common are < for less-than, > for greater-than, & for ampersand, and " for double quote. Encoding these characters prevents browsers from interpreting them as HTML tags, which is critical for security (preventing XSS attacks) and for displaying code samples on web pages.