Skip to content

Instantly share code, notes, and snippets.

@tomas-stefano
Created November 18, 2010 13:32
Show Gist options
  • Select an option

  • Save tomas-stefano/704972 to your computer and use it in GitHub Desktop.

Select an option

Save tomas-stefano/704972 to your computer and use it in GitHub Desktop.
Puts encoding information about the file
open('some_file', "r:UTF-8") do |file|
puts file.external_encoding.name
p file.internal_encoding
file.each do |line|
p [line.encoding.name, line]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment