Skip to main content

is_interchange_invalid

Function is_interchange_invalid 

Source
pub fn is_interchange_invalid(c: char) -> bool
Expand description

Checks if a character is “interchange-invalid” according to Unicode and HTML preprocessing specs.

This function identifies codepoints that can trigger parser inconsistencies or upstream bugs:

  • C0 control characters: ASCII values 0x00..=0x1F except allowed whitespace:
    • Horizontal Tab (0x09)
    • Line Feed (0x0A)
    • Form Feed (0x0C)
    • Carriage Return (0x0D)
  • C1 controls and DEL: 0x7F..=0x9F
  • Unicode Non-characters:
    • Range U+FDD0..=U+FDEF (32 codepoints)
    • Plane non-characters ending in 0xFFFE or 0xFFFF (e.g., U+FFFE, U+FFFF, U+10FFFF)

By identifying these characters early, the library ensures that no malformed unicode reaches client-side rendering engines.