diff --git a/planet/shell/_genshi.py b/planet/shell/_genshi.py index 7880a3ad..c991e628 100644 --- a/planet/shell/_genshi.py +++ b/planet/shell/_genshi.py @@ -137,11 +137,15 @@ def run(script, doc, output_file=None, options={}): context.push(vars) # apply template - output=tmpl.generate(context).render('xml') + if output_file.endswith('.xml'): + method = 'xml' + else: + method = 'xhtml' + output = tmpl.generate(context).render(method) if output_file: out_file = open(output_file,'w') - out_file.write(output) + out_file.write(output.encode('utf-8')) out_file.close() else: return output