Ruby Programming/Reference/Objects/IO

Note that with 1.9, each call will return you a String with an encoding set, based on either how the connection was established, ex:

a = File.new('some filename', 'rb:ASCII-8BIT') # strings from this will be read in as ASCII-8BIT
b = File.new('some filename', 'r') # strings from this will be read in as whatever the Encoding.default_external is
# you can change what the encoding will be
a.set_encoding "UTF-8" # from now on it will read in UTF-8