fix: handle Unicode normalization in save_dict for umlauts (#728) (#729)

This commit is contained in:
Jens
2025-12-15 20:46:10 +01:00
committed by GitHub
parent 861b8ec367
commit 0b995fae18
5 changed files with 125 additions and 6 deletions

View File

@@ -289,8 +289,12 @@ def sanitize_folder_name(name:str, max_length:int = 100) -> str:
if not raw:
return "untitled"
raw = unicodedata.normalize("NFC", raw)
# Apply sanitization, then normalize to NFC
# Note: sanitize-filename converts to NFD, so we must normalize AFTER sanitizing
# to ensure consistent NFC encoding across platforms (macOS HFS+, Linux, Windows)
# This prevents path mismatches when saving files to sanitized directories (issue #728)
safe:str = sanitize(raw)
safe = unicodedata.normalize("NFC", safe)
# Truncate with word-boundary preference
if len(safe) > max_length: