more robust source encoding detection
compatibility with python3 fix
compatibility with python2.5
Merge pull request #115 from andviro/master

more robust source encoding detection