cmake: Encode and decode in UTF-8 in build system

In order to make sure that the build works in folders that require a UTF
encoding, make sure that both CMake and the various Python scripts that
interact with each other on files use the same encoding, in this case
UTF-8.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
diff --git a/scripts/subfolder_list.py b/scripts/subfolder_list.py
index 76927fb..ec97a0c 100644
--- a/scripts/subfolder_list.py
+++ b/scripts/subfolder_list.py
@@ -63,14 +63,14 @@
     existing = ''
 
     if os.path.exists(args.out_file):
-        with open(args.out_file, 'r') as fp:
+        with open(args.out_file, 'r', encoding="utf-8") as fp:
             existing = fp.read()
 
         if new != existing:
-            with open(args.out_file, 'w') as fp:
+            with open(args.out_file, 'w', encoding="utf-8") as fp:
                 fp.write(new)
     else:
-        with open(args.out_file, 'w') as fp:
+        with open(args.out_file, 'w', encoding="utf-8") as fp:
             fp.write(new)
 
     # Always touch trigger file to ensure json files are updated