#--- # Excerpted from "Enterprise Integration with Ruby" # We make no guarantees that this code is fit for any purpose. # Visit http://www.pragmaticprogrammer.com/titles/fr_eir for more book information. #--- def examine_file(file_name) content = IO.read(file_name) puts "Its content is '#{content}'." puts "Content length is #{content.length} bytes." a = []; content.each_byte { |b| a << b }; p a end puts 'Here we have the ISO-8859-1 file...' examine_file('data/iso-8859-1.txt') puts puts '... and here we have the UTF-8 file:' examine_file('data/utf8.txt')