Latin-1, transcoded to UTF-8 : set_encoding « File Directory « Ruby






Latin-1, transcoded to UTF-8


f = File.open("data.txt", "r")   # Open file data.txt for reading
f.set_encoding("iso-8859-1", "utf-8") # Latin-1, transcoded to UTF-8

f = File.open("data.txt", "r")   # Open file data.txt for reading
f.set_encoding("iso-8859-1:utf-8")    # Same as above

 








Related examples in the same category

1.UTF-8 text