Detecting string charset in Python

echo “öasd” | iconv -t ISO-8859-1 | python -c ‘import chardet,sys; print chardet.detect(sys.stdin.read())’
{‘confidence’: 0.5, ‘encoding’: ‘windows-1252’}

from: http://superuser.com/questions/301552/how-to-auto-detect-text-file-encoding

Leave a Reply

Your email address will not be published. Required fields are marked *