Skip to content

Instantly share code, notes, and snippets.

@agimenez
Created May 24, 2011 19:18
Show Gist options
  • Save agimenez/989445 to your computer and use it in GitHub Desktop.
Save agimenez/989445 to your computer and use it in GitHub Desktop.
guess-charset.py
agimenez@bart:~$ echo $LANG
en_US.UTF-8
# After echo "ñéç€" >> test-encoding, which is a copy of the linux-2.6 Makefile (for performance testing)
# The € sign should definitely cause the file to be iso-8859-15 or utf-8
agimenez@bart:~$ guess-charset.py test-encoding
ISO-8859-1
agimenez@bart:~$ file -i test-encoding
test-encoding: text/plain; charset=utf-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment