Skip to content

Commit

Permalink
Set UTF-8 as default encoding for all file operations: see #1391 (com…
Browse files Browse the repository at this point in the history
  • Loading branch information
SamFlt committed Sep 26, 2024
1 parent 31d98b8 commit c14edae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/python/generator/visp_python_bindgen/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def generate_module(generate_path: Path, config_path: Path) -> None:

# Step 3: write to main.cpp the call to the submodule binding implementations.
main_path = generate_path / 'main.cpp'
with open(main_path, 'w') as main_file:
with open(main_path, 'w', encoding='utf-8') as main_file:
submodule_fn_declarations = []
submodule_fn_calls = []
for submodule in submodules:
Expand Down
2 changes: 1 addition & 1 deletion modules/python/generator/visp_python_bindgen/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def run_preprocessor(self):
# if 'visp3' in matches.group() or 'opencv' in matches.group():
# tmp_file_content.append(line)

with open(tmp_file_path.absolute(), 'w') as tmp_file:
with open(tmp_file_path.absolute(), 'w', encoding='utf-8') as tmp_file:
tmp_file.write(''.join(tmp_file_content))
tmp_file.flush()

Expand Down
4 changes: 2 additions & 2 deletions modules/python/generator/visp_python_bindgen/submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _get_config_file_or_create_default(self, path: Path) -> Dict:
'enums': {},
'config_includes': []
}
with open(path, 'w') as config_file:
with open(path, 'w', encoding='utf-8') as config_file:
json.dump(default_config, config_file)
return default_config
else:
Expand Down Expand Up @@ -195,7 +195,7 @@ def generate(self) -> None:
{bindings}
}}
'''
with open(self.submodule_file_path, 'w') as submodule_file:
with open(self.submodule_file_path, 'w', encoding='utf-8') as submodule_file:
submodule_file.write(format_str)

logs_path = self.submodule_file_path.parent.parent / 'logs'
Expand Down

0 comments on commit c14edae

Please sign in to comment.