Also, I'm guessing this can be rewritten as:

```RUBY
if open_args && open_args.last.kind_of?(Hash)
  external = open_args.last[:encoding]
end

string = string.encode(external) if external
```