f = File.open("data.txt", "r") # Open file data.txt for reading f.set_encoding(Encoding::UTF-8) # UTF-8 text