Browse Source

scripts: snippets: Use UTF-8 to write CMake files

UTF-8 is not always the default encoding on some platforms, but it's the
only reliable way to store encoded strings for filenames using
non-ASCII characters.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
pull/58805/head
Carles Cufi 2 years ago committed by Anas Nashif
parent
commit
fde1a239c9
  1. 2
      scripts/snippets.py

2
scripts/snippets.py

@ -311,7 +311,7 @@ def write_cmake_out(snippets: Snippets, cmake_out: Path) -> None: @@ -311,7 +311,7 @@ def write_cmake_out(snippets: Snippets, cmake_out: Path) -> None:
detail and are not meant to be used outside of snippets.cmake.'''
if not cmake_out.parent.exists():
cmake_out.parent.mkdir()
with open(cmake_out, 'w') as f:
with open(cmake_out, 'w', encoding="utf-8") as f:
SnippetToCMakePrinter(snippets, f).print_cmake()
def main():

Loading…
Cancel
Save