diff options
Diffstat (limited to 'sphinx/util/osutil.py')
-rw-r--r-- | sphinx/util/osutil.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py index 840655e42..d0ed42c8c 100644 --- a/sphinx/util/osutil.py +++ b/sphinx/util/osutil.py @@ -6,6 +6,7 @@ import os import re import shutil import sys +import unicodedata from io import StringIO from os import path from typing import Any, Generator, Iterator, List, Optional, Type @@ -34,6 +35,12 @@ def canon_path(nativepath: str) -> str: return nativepath.replace(path.sep, SEP) +def path_stabilize(filepath: str) -> str: + "Normalize path separator and unicode string" + new_path = canon_path(filepath) + return unicodedata.normalize('NFC', new_path) + + def relative_uri(base: str, to: str) -> str: """Return a relative URL from ``base`` to ``to``.""" if to.startswith(SEP): |