Skip to main content

normalize

Function normalize 

Source
pub fn normalize(input: &[u8]) -> String
Expand description

Normalize note body bytes before hashing.

Rules (ยง5.3):

  1. newlines normalized to \n
  2. trailing whitespace stripped from each line
  3. text Unicode-NFC normalized
  4. exactly one trailing newline

Input is treated as UTF-8; replacement chars are used for invalid bytes so hashing never fails on a partially-written file.