Decode output of scripts from utf8 to unicode.

pull/7/head
Ferry Boender 10 years ago
parent ae128624d7
commit 330e8be4e5
  1. 2
      doc/MANUAL.md
  2. 6
      src/scriptform.py

@ -242,6 +242,8 @@ FIXME
client's browser. This allows you to output images, binary files, etc to
the client. The script must include the proper headers and body itself.
**All output is assumed to be UTF8, regardless of system encoding!**
If the script's exit code is 0, the output of the script (stdout) is captured
and shown to the user in the browser.

@ -822,12 +822,12 @@ class ScriptFormWebApp(WebAppHandler):
result = form_config.callback(form_name, form_values, self)
if result:
if result['exitcode'] != 0:
msg = u'<span class="error">{0}</span>'.format(cgi.escape(result['stderr']))
msg = u'<span class="error">{0}</span>'.format(cgi.escape(result['stderr'].decode('utf8')))
else:
if form_def.output == 'escaped':
msg = u'<pre>{0}</pre>'.format(cgi.escape(result['stdout']))
msg = u'<pre>{0}</pre>'.format(cgi.escape(result['stdout'].decode('utf8')))
else:
msg = result['stdout']
msg = result['stdout'].decode('utf8')
output = html_submit_response.format(
header=html_header.format(title=form_config.title),

Loading…
Cancel
Save