Skip to main content

Module binary_detect

Module binary_detect 

Source
Expand description

Binary content detection heuristics. Binary content detection powered by the content_inspector crate (G41).

The previous implementation used a simple null-byte heuristic, which misclassified UTF-16LE and UTF-16BE without BOM as binary (because every ASCII char in UTF-16LE is followed by a 0x00 byte). content_inspector performs BOM detection, UTF-8/16/32 validation, and statistical analysis to correctly classify text in any of the four Unicode encodings.

Enums§

ContentType
The detected content type of a buffer.

Functions§

detect_content_type
Detect the content type of a buffer.
is_binary
Detect whether data is binary.