pyunormalize is a pure-Python library for Unicode normalization (NFC, NFD, NFKC, NFKD) that operates independently of Python's built-in Unicode database. It uses its own dedicated data, ensuring strict conformance to the latest Unicode Standard (currently v17.0.0). New major versions are typically released to align with updates to the Unicode Standard.
pip install pyunormalizeVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to import and use the four primary Unicode normalization forms (NFC, NFD, NFKC, NFKD) provided by pyunormalize, and how to retrieve the Unicode Character Database (UCD) version in use.
Upgrade Python environment to 3.8+ or pin `pyunormalize<17.0.0`.
Understand that `pyunormalize` provides strict, self-contained Unicode version support. Use `pyunormalize.UCD_VERSION` to verify the active Unicode version.
Thoroughly validate and sanitize all user inputs. Do not rely solely on normalization for security checks; consider canonical forms (NFC, NFD) for strict equivalence if possible, and be mindful of compatibility equivalences (NFKC, NFKD) if they are used in security-sensitive comparisons.
pip install pyunormalize
from pyunormalize import unormalize; unormalize('text', 'NFC')from pyunormalize import unormalize, NFC; unormalize('text', 'NFC') # or unormalize('text', NFC)Ensure the input `text` is a Python string (`str`) before passing it to `unormalize`, e.g., `unormalize(str(non_string_data), 'NFC')`.
No dependency data recorded yet.