cherrypick custom_output from master (unicode stdout)