utf-8 encode stdout messages before writing