RE error: illegal byte sequence on Mac OS X
A sample command that exhibits the symptom: sed ‘s/./@/’ <<<$’\xfc’ fails, because byte 0xfc is not a valid UTF-8 char.Note that, by contrast, GNU sed (Linux, but also installable on macOS) simply passes the invalid byte through, without reporting an error. Using the formerly accepted answer is an option if you don’t mind losing support for your true locale (if you’re on a US system … Read more