Skip to content

Instantly share code, notes, and snippets.

@mislav
Created January 31, 2014 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mislav/8723116 to your computer and use it in GitHub Desktop.
Save mislav/8723116 to your computer and use it in GitHub Desktop.
Detect encoding of file contents (or STDIN) with charlock_holmes
ruby -r pp -r charlock_holmes -e '
contents = ARGF.read
detection = CharlockHolmes::EncodingDetector.detect(contents)
pp detection ' "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment