Skip to content

Commit

Permalink
fix(base.py): add encoding when open changlelog_file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Tsai authored and Lee-W committed May 22, 2024
1 parent ee14038 commit 3761124
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion commitizen/changelog_formats/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, config: BaseConfig):
# Constructor needs to be redefined because `Protocol` prevent instantiation by default
# See: https://bugs.python.org/issue44807
self.config = config
self.encoding = self.config.settings["encoding"]

@property
def version_parser(self) -> Pattern:
Expand All @@ -33,7 +34,7 @@ def get_metadata(self, filepath: str) -> Metadata:
if not os.path.isfile(filepath):
return Metadata()

with open(filepath) as changelog_file:
with open(filepath, encoding=self.encoding) as changelog_file:
return self.get_metadata_from_file(changelog_file)

def get_metadata_from_file(self, file: IO[Any]) -> Metadata:
Expand Down

0 comments on commit 3761124

Please sign in to comment.