diff --git a/commitizen/changelog_formats/base.py b/commitizen/changelog_formats/base.py index d0dfd9ec55..7c802d63d4 100644 --- a/commitizen/changelog_formats/base.py +++ b/commitizen/changelog_formats/base.py @@ -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: @@ -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: