encoding fixes to fimplate
This commit is contained in:
@@ -87,7 +87,7 @@ if __name__ == "__main__":
|
||||
if options.template == None:
|
||||
in_reader = sys.stdin
|
||||
else:
|
||||
in_reader = open(options.template, "rb")
|
||||
in_reader = open(options.template, "rt")
|
||||
for l in in_reader:
|
||||
for p in pairs:
|
||||
value = p[1]
|
||||
@@ -96,9 +96,9 @@ if __name__ == "__main__":
|
||||
value = open(value[1:], "rt").read()
|
||||
elif value[0:2] == "\\@":
|
||||
value = value[1:]
|
||||
l = l.replace(p[0].encode("utf-8"), value.encode("utf-8"))
|
||||
l = l.replace(p[0], value)
|
||||
if options.env:
|
||||
var_list = [m.group(0) for m in re.finditer("\${[^ ]+}", l)]
|
||||
for v in var_list:
|
||||
l = l.replace(v, os.environ.get(v[:-1][2:], ""))
|
||||
sys.stdout.write(l.decode("utf-8"))
|
||||
sys.stdout.write(l)
|
||||
|
||||
Reference in New Issue
Block a user