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

Python
2022-09-19 16:31 (2 years ago) ytyng

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.

Archive

2025
2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011