@@ -1508,7 +1508,7 @@ def write_metadata(filename, metadata_list):
15081508 # so filter them from the metadata.
15091509 if not output_metadata .get ("labels" ) and "labels" in output_metadata :
15101510 del output_metadata ["labels" ]
1511- with open (filename , "wt" ) as metadata_file :
1511+ with open (filename , "wt" , encoding = 'utf-8' ) as metadata_file :
15121512 metadata_file .write (YamlSerializer ().dump (output_metadata ))
15131513
15141514 def write (self , output_dir , guid , timestamp = - 1 ):
@@ -1566,8 +1566,8 @@ def write(self, output_dir, guid, timestamp=-1):
15661566 # Create the "pathname" file.
15671567 # export_filename is the path of the file when it's imported into a Unity
15681568 # project.
1569- with open (os .path .join (output_asset_dir , "pathname" ), "wt" ) as (
1570- pathname_file ):
1569+ with open (os .path .join (output_asset_dir , "pathname" ), "wt" ,
1570+ encoding = 'utf-8' ) as ( pathname_file ):
15711571 pathname_file .write (posix_path (os .path .join (ASSETS_DIRECTORY ,
15721572 self .filename )))
15731573 return output_asset_dir
@@ -1893,7 +1893,8 @@ def find_assets(self, assets_dirs, for_upm=False):
18931893 asset_metadata = copy .deepcopy (importer_metadata )
18941894 if os .path .exists (asset_metadata_filename ):
18951895 existing_asset_metadata = collections .OrderedDict ()
1896- with open (asset_metadata_filename , "rt" ) as asset_metadata_file :
1896+ with open (asset_metadata_filename , "rt" , encoding = 'utf-8' ) as (
1897+ asset_metadata_file ):
18971898 existing_asset_metadata = YamlSerializer ().load (
18981899 asset_metadata_file .read ())
18991900 if existing_asset_metadata :
@@ -2341,7 +2342,7 @@ def write_manifest(self, output_dir, assets):
23412342 manifest_directory = os .path .dirname (manifest_absolute_path )
23422343 if not os .path .exists (manifest_directory ):
23432344 os .makedirs (manifest_directory )
2344- with open (manifest_absolute_path , "wt" ) as manifest_file :
2345+ with open (manifest_absolute_path , "wt" , encoding = 'utf-8' ) as manifest_file :
23452346 manifest_file .write (
23462347 "%s\n " % "\n " .join ([posix_path (os .path .join (ASSETS_DIRECTORY ,
23472348 asset .filename ))
@@ -2433,7 +2434,7 @@ def write_upm_manifest(self, output_dir):
24332434 "\n %s" ) % (self .name , "\n " .join (missing_deps )))
24342435 package_manifest ["dependencies" ] = dependencies
24352436
2436- with open (manifest_absolute_path , "wt" ) as manifest_file :
2437+ with open (manifest_absolute_path , "wt" , encoding = 'utf-8' ) as manifest_file :
24372438 json .dump (package_manifest , manifest_file , indent = 2 )
24382439
24392440 return Asset (
@@ -2510,7 +2511,7 @@ def create_archive(archive_filename, input_directory, timestamp):
25102511 try :
25112512 # Create a list of input files to workaround command line length
25122513 # limits.
2513- with open (list_filename , "wt" ) as list_file :
2514+ with open (list_filename , "wt" , encoding = 'utf-8' ) as list_file :
25142515 list_file .write ("%s\n " % "\n " .join (input_filenames ))
25152516
25162517 tar_args = ["tar" ]
@@ -3238,7 +3239,7 @@ def read_json_file_into_ordered_dict(json_filename):
32383239 ValueError: If there is a parse error while reading the file.
32393240 """
32403241 json_dict = None
3241- with open (json_filename , "rt" ) as json_file :
3242+ with open (json_filename , "rt" , encoding = 'utf-8' ) as json_file :
32423243 try :
32433244 json_dict = json .loads (json_file .read (),
32443245 object_pairs_hook = collections .OrderedDict )
0 commit comments