added chardet detection of file's encoding type