pub fn is_valid_entity_code(code: u32) -> bool
Expand description
Return true if a code
you got from &#xHHHH;
entity is a valid charcode.
It returns false for surrogates and non-printables, so it’s a subset of char::from_u32
.
For example, it returns false for 0xFDD0, which is a valid character, but not safe to
render on the screen due to turning you into stone, as per https://xkcd.com/380/
assert_eq!(is_valid_entity_code(1), false);
assert_eq!(is_valid_entity_code(32), true);