Skip to content

add hook to automatically switch unicode characters to nearest equivalent. #3

Open
@jgstew

Description

use unidecode python module to switch non ascii characters within UTF8 to nearest ascii equivalent.

            with open(this_path) as f:
                file_contents = f.read()

            if not file_contents.isascii():
                print(
                    f"Invalid: {dirpath} - {filename} contained non-ascii chars found by Python"
                )
                with open(this_path, "wt", encoding="utf-8") as this_file:
                    this_file.write(unidecode(file_contents))

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions