Feature #10237
openTransform all elements of one Encoding into another Encoding for Array and Hash
Description
I find myself to sometimes have to convert one encoding to the other.
For string objects, this is trivial:
.encode()
.force_encoding()
For reading in a file via File.readlines(), this is also
simple because of stuff like:
File.readlines('test.txt', :encoding => 'ascii-8bit')
For Array and Hashes, however, this is a bit annoying for me.
I'd love to have an .encode method as well.
This method should try to convert all elements on an Array
or a Hash to another encoding IF they are a string object.
I'd like to be able to treat Array and Hashes in the same
way, so that I can e. g. convert a hash dictionary from
one encoding to the other quickly.
It already is possible of course, with some extra lines
of code, but I'd love to have a way to do so with just
one method call.
: