@@ -103,7 +103,7 @@ def doImport(scope, code, module):
103
103
for dir in [ os .path .dirname (namestack [- 1 ]), install_path + "/modules" , "." ]:
104
104
filename = dir + "/" + modname + ".hny"
105
105
if os .path .exists (filename ):
106
- with open (filename ) as f :
106
+ with open (filename , encoding = 'utf-8' ) as f :
107
107
load (f , filename , scope2 , code )
108
108
found = True
109
109
break
@@ -2523,7 +2523,7 @@ def doImport(self, scope, code, module):
2523
2523
for dir in [ os .path .dirname (namestack [- 1 ]), install_path + "/modules" , "." ]:
2524
2524
filename = dir + "/" + modname + ".hny"
2525
2525
if os .path .exists (filename ):
2526
- with open (filename ) as f :
2526
+ with open (filename , encoding = 'utf-8' ) as f :
2527
2527
load (f , filename , scope2 , code )
2528
2528
found = True
2529
2529
break
@@ -5380,7 +5380,7 @@ def doCompile(filenames, consts, mods, interface):
5380
5380
code .append (FrameOp (("__init__" , None , None , None ), []))
5381
5381
for fname in filenames :
5382
5382
try :
5383
- with open (fname ) as fd :
5383
+ with open (fname , encoding = 'utf-8' ) as fd :
5384
5384
load (fd , fname , scope , code )
5385
5385
except IOError :
5386
5386
print ("harmony: can't open" , fname , file = sys .stderr )
@@ -5996,7 +5996,7 @@ def htmlcode(code, scope, f):
5996
5996
print ("</div>" , file = f )
5997
5997
5998
5998
def htmldump (nodes , code , scope , node , fulldump , verbose ):
5999
- with open ("harmony.html" , "w" ) as f :
5999
+ with open ("harmony.html" , "w" , encoding = 'utf-8' ) as f :
6000
6000
print ("""
6001
6001
<html>
6002
6002
<head>
@@ -7576,7 +7576,7 @@ def main():
7576
7576
code , scope = doCompile (args , consts , mods , interface )
7577
7577
except HarmonyCompilerError as e :
7578
7578
if parse_code_only :
7579
- with open (outputfiles ["hvm" ], "w" ) as f :
7579
+ with open (outputfiles ["hvm" ], "w" , encoding = 'utf-8' ) as f :
7580
7580
data = {
7581
7581
"errors" : [e .token ._as_dict ()],
7582
7582
"status" : "error"
@@ -7586,12 +7586,12 @@ def main():
7586
7586
sys .exit (1 )
7587
7587
7588
7588
if parse_code_only :
7589
- with open (outputfiles ["hvm" ], "w" ) as f :
7589
+ with open (outputfiles ["hvm" ], "w" , encoding = 'utf-8' ) as f :
7590
7590
f .write (json .dumps ({"status" : "ok" }))
7591
7591
return
7592
7592
7593
7593
if outputfiles ["tla" ] != None :
7594
- with open (outputfiles ["tla" ], "w" ) as fd :
7594
+ with open (outputfiles ["tla" ], "w" , encoding = 'utf-8' ) as fd :
7595
7595
tla_translate (fd , code , scope )
7596
7596
7597
7597
install_path = os .path .dirname (os .path .realpath (__file__ ))
@@ -7600,7 +7600,7 @@ def main():
7600
7600
# see if there is a configuration file
7601
7601
infile = "%s/charm.c" % install_path
7602
7602
outfile = "%s/charm.exe" % install_path
7603
- with open (outputfiles ["hvm" ], "w" ) as fd :
7603
+ with open (outputfiles ["hvm" ], "w" , encoding = 'utf-8' ) as fd :
7604
7604
dumpCode ("json" , code , scope , f = fd )
7605
7605
print ("Phase 2: run the model checker" )
7606
7606
sys .stdout .flush ()
0 commit comments