Skip to content

Commit

Permalink
!B: fix encoding issue for other characters set
Browse files Browse the repository at this point in the history
Fix this #227
This commit is to set the encoding when open a file. It's useful for
other characters set users.
  • Loading branch information
caomingpei committed May 9, 2024
1 parent ec9bbb9 commit a26a60b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mkdocs_macros/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def _load_yaml(self):
# Paths are be relative to the project root.
filename = os.path.join(self.project_dir, filename)
if os.path.isfile(filename):
with open(filename) as f:
with open(filename, encoding="utf-8") as f:
# load the yaml file
# NOTE: for the SafeLoader argument, see: https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation
content = yaml.load(f, Loader=yaml.SafeLoader)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

def read_file(fname):
"Read a local file"
return open(os.path.join(os.path.dirname(__file__), fname)).read()
return open(os.path.join(os.path.dirname(__file__), fname), encoding="utf-8").read()


setup(
Expand Down

0 comments on commit a26a60b

Please sign in to comment.