Add spec for IO.readlines using the default external encoding
Use the correct encoding in IO.readlines, IO#gets, etc

Fixes #2306