Handle UTF-8 encoding for judge

Incorrect if program output not UTF-8. For logs, invalid encodings are
replaced.
Merge branch 'master' of github.com:NZOI/nztrain