fix the compile error when the file is not valid encoding