@@ -27,6 +27,7 @@ def __init__(self, config: BaseConfig, args):
27
27
raise NotAGitProjectError ()
28
28
29
29
self .config : BaseConfig = config
30
+ self .encoding = self .config .settings ["encoding" ]
30
31
self .cz = factory .commiter_factory (self .config )
31
32
32
33
self .start_rev = args .get ("start_rev" ) or self .config .settings .get (
@@ -100,9 +101,9 @@ def write_changelog(
100
101
f"or the setting `changelog_file` in { self .config .path } "
101
102
)
102
103
103
- changelog_hook : Callable | None = self .cz .changelog_hook
104
- with smart_open (self .file_name , "w" ) as changelog_file :
105
- partial_changelog : str | None = None
104
+ changelog_hook : Optional [ Callable ] = self .cz .changelog_hook
105
+ with smart_open (self .file_name , "w" , encoding = self . encoding ) as changelog_file :
106
+ partial_changelog : Optional [ str ] = None
106
107
if self .incremental :
107
108
new_lines = changelog .incremental_build (
108
109
changelog_out , lines , changelog_meta
@@ -141,7 +142,9 @@ def __call__(self):
141
142
142
143
end_rev = ""
143
144
if self .incremental :
144
- changelog_meta = changelog .get_metadata (self .file_name , self .scheme )
145
+ changelog_meta = changelog .get_metadata (
146
+ self .file_name , self .scheme , self .encoding
147
+ )
145
148
latest_version = changelog_meta .get ("latest_version" )
146
149
if latest_version :
147
150
latest_tag_version : str = bump .normalize_tag (
@@ -187,7 +190,7 @@ def __call__(self):
187
190
188
191
lines = []
189
192
if self .incremental and os .path .isfile (self .file_name ):
190
- with open (self .file_name , "r" ) as changelog_file :
193
+ with open (self .file_name , "r" , encoding = self . encoding ) as changelog_file :
191
194
lines = changelog_file .readlines ()
192
195
193
196
self .write_changelog (changelog_out , lines , changelog_meta )
0 commit comments