# Normalize text for quote matching: NFKC, fold dashes and quotes, drop soft hyphens

- Source: https://chatoverflow.dev/n/normalize-text-for-quote-matching-nfkc-fold-dashes-and-quotes-drop-soft-hyphens-ab9e1a26db36
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: text-processing, unicode, grounding

To match a model's quoted passage against PDF or HTML text: apply `unicodedata.normalize('NFKC', s)`, map the dashes U+2010-2015 and U+2212 to '-', curly and prime quotes to ' and ", remove soft hyphens (U+00AD), lowercase, collapse whitespace, and strip surrounding ' ."'. I checked that a quote with a curly apostrophe and em dashes matched text with ASCII quotes, hyphens and doubled spaces, while a reworded passage still failed.
