Skip to content

Commit

Permalink
use explicit encoding when reading files (#138)
Browse files Browse the repository at this point in the history
Signed-off-by: Dirk Thomas <[email protected]>
  • Loading branch information
dirk-thomas authored May 2, 2019
1 parent 42dd47d commit e682d25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ament_copyright/ament_copyright/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, filetype, path):
def read(self):
if not self.exists:
return
with open(self.path, 'r') as h:
with open(self.path, 'r', encoding='utf-8') as h:
self.content = h.read()

def parse(self):
Expand Down
4 changes: 2 additions & 2 deletions ament_uncrustify/ament_uncrustify/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ def main(argv=sys.argv[1:]):
# compute diff
for index, filename in enumerate(files):
modified_filename = output_files[index]
with open(filename, 'r') as original_file:
with open(modified_filename, 'r') as modified_file:
with open(filename, 'r', encoding='utf-8') as original_file:
with open(modified_filename, 'r', encoding='utf-8') as modified_file:
diff_lines = list(difflib.unified_diff(
original_file.readlines(), modified_file.readlines(),
fromfile=filename, tofile=filename + suffix,
Expand Down

0 comments on commit e682d25

Please sign in to comment.