Fixed chardetect for non-ascii file names

chardetect failed with 'UnicodeDecodeError' exception when passing files names with non-ascii characters. Hope this fixes the issue.