Skip to content

Commit

Permalink
Consistency: use utf-8 encoding name everywhere
Browse files Browse the repository at this point in the history
In fact, Python codec is `utf_8` but it has aliases, `utf8' (declared as
alias) or `utf-8` (because `_` or `-` do not make difference) are
working, but we mainly use `utf-8` among the code.

See https://docs.python.org/3/library/codecs.html#standard-encodings
  • Loading branch information
zas authored and phw committed Sep 25, 2023
1 parent a9d4efd commit 15bf226
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions picard/script/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def export_script(self, parent=None):
else:
script_text = self.script + "\n"
try:
with open(filename, 'w', encoding='utf8') as o_file:
with open(filename, 'w', encoding='utf-8') as o_file:
o_file.write(script_text)
except OSError as error:
raise ScriptImportExportError(format=FILE_ERROR_EXPORT, filename=filename, error_msg=error.strerror)
Expand Down Expand Up @@ -252,7 +252,7 @@ def import_script(cls, parent=None):
return None
log.debug("Importing script file: %s", filename)
try:
with open(filename, 'r', encoding='utf8') as i_file:
with open(filename, 'r', encoding='utf-8') as i_file:
file_content = i_file.read()
except OSError as error:
raise ScriptImportExportError(format=FILE_ERROR_IMPORT, filename=filename, error_msg=error.strerror)
Expand Down
4 changes: 2 additions & 2 deletions picard/tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def handle_command_submit_fingerprints(self, argstring):

def handle_command_write_logs(self, argstring):
try:
with open(argstring, 'w', encoding='utf8') as f:
with open(argstring, 'w', encoding='utf-8') as f:
for x in self.window.log_dialog.log_tail.contents():
f.write(f"{x.message}\n")
except Exception as e:
Expand Down Expand Up @@ -1533,7 +1533,7 @@ def main(localedir=None, autoupdate=True):
identifier = uuid4().hex
else:
if picard_args.config_file:
identifier = blake2b(picard_args.config_file.encode('utf8'), digest_size=16).hexdigest()
identifier = blake2b(picard_args.config_file.encode('utf-8'), digest_size=16).hexdigest()
else:
identifier = 'main'
if picard_args.no_plugins:
Expand Down

0 comments on commit 15bf226

Please sign in to comment.