Skip to content

Commit addfa64

Browse files
author
Pete Hemery
committed
bugfix: treat labels file as utf-8 encoded when modifying
1 parent 6ca2e9a commit addfa64

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

prelapse/modifier/label_modifier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def run_labels(self, args):
4646
self.parse_args(args, "Label Modifier")
4747
if not os.path.exists(args.labels):
4848
raise RuntimeError("Labels file '{}' does not exist".format(args.labels))
49-
with open(args.labels, "rb") as input_file:
49+
with open(args.labels, "r", encoding="utf-8") as input_file:
5050
# Read the contents of the file
5151
lines = input_file.readlines()
5252
if args.dry_run:
@@ -55,8 +55,8 @@ def run_labels(self, args):
5555
modified_lines = modify_lines(self, args, lines)
5656
self.logger.debug(modified_lines)
5757
if not args.dry_run:
58-
with open(args.labels, "wb") as output_file:
58+
with open(args.labels, "w", encoding="utf-8") as output_file:
5959
# Iterate through each line
6060
for line in modified_lines:
6161
# Write the modified line to the output file
62-
output_file.write(line.encode("utf-8"))
62+
output_file.write(line)

0 commit comments

Comments
 (0)