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>
This commit is contained in:
Carles Cufi 2023-06-02 14:27:53 +02:00 committed by Anas Nashif
parent 16fa99a887
commit fde1a239c9

View file

@ -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():