Check chardet availability before using it