Convert stdout and stderr to UTF-8 properly in the run_cmd helper.