file.write() need bytes when file is opened in binary mode

Avoid "TypeError: a bytes-like object is required, not 'str'" error during
write().
As the outfile need to be opened in binary mode, so python 3 require bytes
stream as argument in outfile.write().
Fixed by set all output string write to utf-8 encoding.

Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
1 file changed