Skip to content

Commit

Permalink
Add utf8 encoding to read_text to avoid Windows charmap crash (#2627)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucain <lucain@huggingface.co>
  • Loading branch information
tomaarsen and Wauplin authored Oct 24, 2024
1 parent 7709178 commit 6ac7aef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/huggingface_hub/hf_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9165,7 +9165,7 @@ def _prepare_upload_folder_additions(
# It's better to fail early than to fail after all the files have been hashed.
if "README.md" in filtered_repo_objects:
self._validate_yaml(
content=relpath_to_abspath["README.md"].read_text(),
content=relpath_to_abspath["README.md"].read_text(encoding="utf8"),
repo_type=repo_type,
token=token,
)
Expand Down

0 comments on commit 6ac7aef

Please sign in to comment.