diff --git a/doc/MANUAL.md b/doc/MANUAL.md index cc6ef31..525c4fc 100644 --- a/doc/MANUAL.md +++ b/doc/MANUAL.md @@ -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. diff --git a/src/scriptform.py b/src/scriptform.py index b4f9fad..4f5e6e7 100755 --- a/src/scriptform.py +++ b/src/scriptform.py @@ -822,12 +822,12 @@ class ScriptFormWebApp(WebAppHandler): result = form_config.callback(form_name, form_values, self) if result: if result['exitcode'] != 0: - msg = u'{0}'.format(cgi.escape(result['stderr'])) + msg = u'{0}'.format(cgi.escape(result['stderr'].decode('utf8'))) else: if form_def.output == 'escaped': - msg = u'
{0}
'.format(cgi.escape(result['stdout'])) + msg = u'
{0}
'.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),