I've written a wrapper script that I alias to cat, called safecat, that protects me from accidentally catting binaries and getting a ton of screeching from my PC speaker. Right now it considers a file to be binary and will refuse to cat it if 30% or more of the characters within the first page are nontext characters (ASCII range 32-127 and \n\r\t\b). It just occurred to me though I really don't have any problem with catting a binary so long as I don't get the screeching and my terminal isn't messed up afterwards. Is there a set of characters or character sequences that I can specifically look for and refuse to cat if those are present? That would be more robust.
safecat.py source: http://github.com/jgarvin/joe-etc/blob/master/safecat.py