Chih-Hsuan Yen wrote: > How about following the idea from Pádraig Brady > and filter \n only? Given the later comments it seems better to filter out encoding errors and control characters. Programs that parse the output already cannot trust the strings to be exactly right, since newlines are gonna get replaced no matter what. So there seems little benefit to copying the other garbage faithfully. Revised proposed patch(es) attached.