File each_char method reads character by character.
In some character sets, characters may be represented by more than one byte:
File.open("main.rb").each_char { |byte| puts byte }