in src/utils/sanitizer.ts [100:124]
function normalizeHtmlEntities(content: string): string {
// Decode numeric decimal entities (H = 'H')
content = content.replace(/&#(\d+);/g, (_, dec) => {
const num = parseInt(dec, 10);
// Only decode printable ASCII range
if (num >= 32 && num <= 126) {
return String.fromCharCode(num);
}
// Remove non-printable entities
return "";
});
// Decode hex entities (H = 'H')
content = content.replace(/&#x([0-9a-fA-F]+);/g, (_, hex) => {
const num = parseInt(hex, 16);
// Only decode printable ASCII range
if (num >= 32 && num <= 126) {
return String.fromCharCode(num);
}
// Remove non-printable entities
return "";
});
return content;
}