@@ -1508,7 +1508,7 @@ def write_metadata(filename, metadata_list):
1508
1508
# so filter them from the metadata.
1509
1509
if not output_metadata .get ("labels" ) and "labels" in output_metadata :
1510
1510
del output_metadata ["labels" ]
1511
- with open (filename , "wt" ) as metadata_file :
1511
+ with open (filename , "wt" , encoding = 'utf-8' ) as metadata_file :
1512
1512
metadata_file .write (YamlSerializer ().dump (output_metadata ))
1513
1513
1514
1514
def write (self , output_dir , guid , timestamp = - 1 ):
@@ -1566,8 +1566,8 @@ def write(self, output_dir, guid, timestamp=-1):
1566
1566
# Create the "pathname" file.
1567
1567
# export_filename is the path of the file when it's imported into a Unity
1568
1568
# 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 ):
1571
1571
pathname_file .write (posix_path (os .path .join (ASSETS_DIRECTORY ,
1572
1572
self .filename )))
1573
1573
return output_asset_dir
@@ -1893,7 +1893,8 @@ def find_assets(self, assets_dirs, for_upm=False):
1893
1893
asset_metadata = copy .deepcopy (importer_metadata )
1894
1894
if os .path .exists (asset_metadata_filename ):
1895
1895
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 ):
1897
1898
existing_asset_metadata = YamlSerializer ().load (
1898
1899
asset_metadata_file .read ())
1899
1900
if existing_asset_metadata :
@@ -2341,7 +2342,7 @@ def write_manifest(self, output_dir, assets):
2341
2342
manifest_directory = os .path .dirname (manifest_absolute_path )
2342
2343
if not os .path .exists (manifest_directory ):
2343
2344
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 :
2345
2346
manifest_file .write (
2346
2347
"%s\n " % "\n " .join ([posix_path (os .path .join (ASSETS_DIRECTORY ,
2347
2348
asset .filename ))
@@ -2433,7 +2434,7 @@ def write_upm_manifest(self, output_dir):
2433
2434
"\n %s" ) % (self .name , "\n " .join (missing_deps )))
2434
2435
package_manifest ["dependencies" ] = dependencies
2435
2436
2436
- with open (manifest_absolute_path , "wt" ) as manifest_file :
2437
+ with open (manifest_absolute_path , "wt" , encoding = 'utf-8' ) as manifest_file :
2437
2438
json .dump (package_manifest , manifest_file , indent = 2 )
2438
2439
2439
2440
return Asset (
@@ -2510,7 +2511,7 @@ def create_archive(archive_filename, input_directory, timestamp):
2510
2511
try :
2511
2512
# Create a list of input files to workaround command line length
2512
2513
# limits.
2513
- with open (list_filename , "wt" ) as list_file :
2514
+ with open (list_filename , "wt" , encoding = 'utf-8' ) as list_file :
2514
2515
list_file .write ("%s\n " % "\n " .join (input_filenames ))
2515
2516
2516
2517
tar_args = ["tar" ]
@@ -3238,7 +3239,7 @@ def read_json_file_into_ordered_dict(json_filename):
3238
3239
ValueError: If there is a parse error while reading the file.
3239
3240
"""
3240
3241
json_dict = None
3241
- with open (json_filename , "rt" ) as json_file :
3242
+ with open (json_filename , "rt" , encoding = 'utf-8' ) as json_file :
3242
3243
try :
3243
3244
json_dict = json .loads (json_file .read (),
3244
3245
object_pairs_hook = collections .OrderedDict )
0 commit comments