```
a = "\xFE"
a.encode!("US-ASCII") #=> Encoding::InvalidByteSequenceError: "\xFE" on UTF-8
```
Both these encodings are ascii_compatible

But when I call it from IO#write, it converts without exception, it goes in the if condition in string19.rb line 72 where it checks for  ascii_only? and to_enc.ascii_compatible?

So I think we could change the encode! method, but we actually need a method to just check if the string has a invalid byte sequence which I have extracted into  check_invalid_bytes