I don't know how to get that out of the Encode perl modules, however. Can you or anyone else help out? Sure. Will provide patch. So it would still look like a separate perl invocation through which the log files are piped. As I intend the patch, the options when you open the file will make this transparent. As an aside, I still don't see how to inject these non-UTF-8 characters into the logs. The example given above (using sudo) does not work; the characters are escaped before writing to the log....
In investigating this issue, I have assembled some simple commands for investigating UTF-8 and getting corrupt UTF-8 and ANSI control sequences logged: # ANSI escape sequence # (sequence from stderr output of `reset`) echo "$(printf '\x1b\x63\x1b\x5d\x31\x30\x34\x07\x1b\x5b\x21\x70\x1b\x5b\x3f\x33\x3b\x34\x6c\x1b\x5b\x34\x6c\x1b\x3e\x0d')" # Valid UTF-8 (inverted exclamantion point) echo "$(printf '\xc2\xa1')" # Invalid UTF-8 (same character, missing a continuatin bit on second byte) echo "$(printf...