Fixing the Issue of Separated Voiced Marks in Folder Names on Mac When Outputting from Python

Python
2022-09-19 07:31 (3 years ago)
Fixing the Issue of Separated Voiced Marks in Folder Names on Mac When Outputting from Python

When trying to output directory names on a Mac

プ ロシ゛ ェクト

If it ends up looking like this, you can fix it by using

import unicodedata
unicodedata.normalize('NFC', folder_name)

You can correct it with the built-in unicodedata module.

This process is called converting from NFD normalization to NFC normalization of Unicode.

Reference: Handling Unicode normalization NFC/NFD strings in Python - forest book

Currently unrated
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Categories

Archive