Python character encoding detector