If the file is not entirely encoded in valid utf-8, then the best thing to do is probably to assume that it's in some other encoding and bail entirely.