Skip to content

Commit a099f57

Browse files
authored
file operation with UTF-8
1 parent 5463bee commit a099f57

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

builder/frameworks/component_manager.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def _remove_ignored_lib_includes(self) -> None:
433433
self._log_change("BT/BLE protection enabled")
434434

435435
try:
436-
with open(build_py_path, 'r') as f:
436+
with open(build_py_path, 'r', encoding='utf-8') as f:
437437
content = f.read()
438438

439439
original_content = content
@@ -480,7 +480,7 @@ def _remove_ignored_lib_includes(self) -> None:
480480

481481
# Validate and write changes
482482
if self._validate_changes(original_content, content) and content != original_content:
483-
with open(build_py_path, 'w') as f:
483+
with open(build_py_path, 'w', encoding='utf-8') as f:
484484
f.write(content)
485485
self._log_change(f"Updated build file ({total_removed} total removals)")
486486

@@ -552,7 +552,7 @@ def _create_default_component_yml(self, file_path: str) -> None:
552552
}
553553
}
554554

555-
with open(file_path, 'w') as f:
555+
with open(file_path, 'w', encoding='utf-8') as f:
556556
yaml.dump(default_content, f)
557557

558558
def _load_component_yml(self, file_path: str) -> Dict[str, Any]:
@@ -566,7 +566,7 @@ def _load_component_yml(self, file_path: str) -> Dict[str, Any]:
566566
Parsed YAML data
567567
"""
568568
try:
569-
with open(file_path, "r") as f:
569+
with open(file_path, "r", encoding='utf-8') as f:
570570
return yaml.load(f, Loader=SafeLoader) or {"dependencies": {}}
571571
except Exception:
572572
return {"dependencies": {}}
@@ -580,7 +580,7 @@ def _save_component_yml(self, file_path: str, data: Dict[str, Any]) -> None:
580580
data: Data to save
581581
"""
582582
try:
583-
with open(file_path, "w") as f:
583+
with open(file_path, "w", encoding='utf-8') as f:
584584
yaml.dump(data, f)
585585
except Exception:
586586
pass
@@ -698,7 +698,7 @@ def _remove_cpppath_entries(self) -> None:
698698
return
699699

700700
try:
701-
with open(build_py_path, 'r') as f:
701+
with open(build_py_path, 'r', encoding='utf-8') as f:
702702
content = f.read()
703703

704704
original_content = content
@@ -715,7 +715,7 @@ def _remove_cpppath_entries(self) -> None:
715715
content = re.sub(pattern, '', content)
716716

717717
if content != original_content:
718-
with open(build_py_path, 'w') as f:
718+
with open(build_py_path, 'w', encoding='utf-8') as f:
719719
f.write(content)
720720

721721
except Exception:

0 commit comments

Comments
 (0)