Estimate the escaped length when special characters (&, <, >, quotes, etc.) are converted to HTML entities.
用于预估 HTML 转义后文本长度。
| Item | Formula / Rule | Source / Standard |
|---|---|---|
| Named entity length | "&", "<" and ">" take 4 to 6 characters, longer than the literal character | HTML Living Standard §13.5 Named character references |
| Numeric reference | Written as "&#nnn;" or "&#xHH;", growing with the decimal digits of the code point | HTML Living Standard §13.5 Numeric character references |
| Minimum escape set | Text nodes need only & and < escaped; attribute values also need the quote character | ISO 8879 SGML Reference Concrete Syntax |