Splash (@de9374) raises UnicodeEncodeError if you run a JavaScript that passes a non-ASCII string to console.log(…). Here's an example curl request that triggers this error:
Note that the request completes successfully, but the call to console.log() does not complete successfully. The Splash log (using -v 2 verbosity) shows:
2015-02-04 13:19:25.774045 [render] <unicode instance at 0x7fb10d27a060 with str error:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/twisted/python/reflect.py", line 391, in _safeFormat
return formatter(o)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 15-16: ordinal not in range(128)
>
I know the log is supposed to be ASCII safe, but this can cause problems when trying to log information about content on a page (e.g. logging alt text for an image) that is outside the control of the program author. Maybe we could use \u style encoding like JSON does? E.g. log \u4f60\u597d instead of 你好.
Splash (@de9374) raises
UnicodeEncodeError
if you run a JavaScript that passes a non-ASCII string toconsole.log(…)
. Here's an example curl request that triggers this error:Note that the request completes successfully, but the call to
console.log()
does not complete successfully. The Splash log (using-v 2
verbosity) shows:I know the log is supposed to be ASCII safe, but this can cause problems when trying to log information about content on a page (e.g. logging alt text for an image) that is outside the control of the program author. Maybe we could use
\u
style encoding like JSON does? E.g. log\u4f60\u597d
instead of你好
.