bom-strip 0.1.0

Strip UTF-8/16/32 BOM bytes and stray U+FEFF code points from text before parsing or hashing. Zero deps.
Documentation
  • Coverage
  • 100%
    12 out of 12 items documented1 out of 7 items with examples
  • Size
  • Source code size: 19.13 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 330.3 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • MukundaKatta/bom-strip
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MukundaKatta

bom-strip

crates.io

Strip UTF-8/16/32 BOMs and stray U+FEFF code points from text before parsing or hashing.

use bom_strip::{strip_str, strip_bytes, detect_bom, Bom};
assert_eq!(strip_str("\u{FEFF}hello"), "hello");
assert_eq!(strip_bytes(&[0xEF, 0xBB, 0xBF, b'h', b'i']), &[b'h', b'i']);
assert_eq!(detect_bom(&[0xFF, 0xFE, b'a', 0]), Some(Bom::Utf16Le));

Handles UTF-32 LE before UTF-16 LE (same first two bytes). Zero deps. MIT or Apache-2.0.