Fix to compile with multibyte characters

If a source file contains multibyte characters (Japanese characters),
Check Syntax or Display JavaScript fails with UnicodeEncodeError on
Windows. Adding encode/decode with utf-8 works without errors.
I've tested this on Windows and OS X.