Not sure. It might be worth checking what other text editors do.

We could black list known binary file types. We could also do some content sniffing on the first ~100 bytes of the file.