scripts: update open calls to use explicit encoding

BUG=b:187789896
TEST=`cros lint` is clean here

Change-Id: Ia54475869c17292505537334362cd4cff6438b14
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4290041
Commit-Queue: Cindy Lin <xcl@google.com>
Reviewed-by: Cindy Lin <xcl@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/cros_install_debug_syms.py b/scripts/cros_install_debug_syms.py
index 222ac61..0573a77 100644
--- a/scripts/cros_install_debug_syms.py
+++ b/scripts/cros_install_debug_syms.py
@@ -100,7 +100,9 @@
             )
 
             with open(
-                self._vartree.getpath(cpv, filename="CONTENTS"), "a"
+                self._vartree.getpath(cpv, filename="CONTENTS"),
+                "a",
+                encoding="utf-8",
             ) as content_file:
                 # Merge the content of the temporary dir into the sysroot.
                 # pylint: disable=protected-access
@@ -431,5 +433,5 @@
     # binpkg will set DEBUG_SYMBOLS automatically if it detects the debug symbols
     # in the packages dir.
     pkgindex = binpkg.GrabLocalPackageIndex(packages_dir)
-    with open(packages_file, "w") as p:
+    with open(packages_file, "w", encoding="utf-8") as p:
         pkgindex.Write(p)