rubinius/rubinius — pull request #2559 by leocassarani (2013-08-17 23:01:47+00:00)
Title: Fix for #2519: File.read returns data with wrong encoding

Twofold issue, as it turns out:

* `IO.read` (and consequently `File.read`) wasn't passing the `options` hash along to `File.new`, so encodings etc were being silently ignored. I've added a spec and fixed this.
* The issue reported in #2519 was happening specifically because an `Encoding` instance was being passed in as the `:encoding` option. This is undocumented behaviour which happens to work under MRI. I've now added specs and implemented support for it across all IO methods that take an options hash.