[FIX]Used uchardet_delete too early.

This commit is contained in:
zhangpengfei 2021-02-07 10:11:30 +08:00
parent 12e78e03f7
commit a01e7000bd
1 changed files with 2 additions and 2 deletions

View File

@ -557,13 +557,13 @@ void FileUtils::getTxtContent(QString &path, QString &textcontent)
uchardet_data_end(chardet);
const char *codec = uchardet_get_charset(chardet);
uchardet_delete(chardet);
if(QTextCodec::codecForName(codec) == 0)
qWarning()<<"Unsupported Text encoding format"<<path;
qWarning()<<"Unsupported Text encoding format"<<path<<QString::fromLocal8Bit(codec);
QTextStream stream(encodedString,QIODevice::ReadOnly);
stream.setCodec(codec);
uchardet_delete(chardet);
textcontent = stream.readAll().replace("\n","");