HTML Encode
Protecting and Rendering Special Characters in HTML
HTML Encoding
HTML encoding, also known as character encoding or entity encoding, is a technique used to represent special characters and symbols within an HTML document. Since HTML has reserved characters with special meanings (such as <, >, ", ', and &), encoding is necessary to display these characters correctly.
How does HTML encoding work?
HTML encoding replaces reserved characters with their corresponding character entities. For example, the less-than sign (<) is replaced with "<", and the greater-than sign (>) is replaced with ">". The ampersand (&) is replaced with "&" to prevent it from being confused with the start of an entity.