📏 HTML Entity Length
Estimate the escaped length when special characters (&, <, >, quotes, etc.) are converted to HTML entities.
📐 計算公式與說明
& < > " 等佔 4-5 字元
Unicode 實體 HHHH; 約 7-8 字元
Unicode 實體 HHHH; 約 7-8 字元
用於預估 HTML 轉義後文本長度。
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 |