forked from openkylin/ukui-search
[FIX]Used uchardet_delete too early.
This commit is contained in:
parent
12e78e03f7
commit
a01e7000bd
|
@ -557,13 +557,13 @@ void FileUtils::getTxtContent(QString &path, QString &textcontent)
|
||||||
|
|
||||||
uchardet_data_end(chardet);
|
uchardet_data_end(chardet);
|
||||||
const char *codec = uchardet_get_charset(chardet);
|
const char *codec = uchardet_get_charset(chardet);
|
||||||
uchardet_delete(chardet);
|
|
||||||
|
|
||||||
if(QTextCodec::codecForName(codec) == 0)
|
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);
|
QTextStream stream(encodedString,QIODevice::ReadOnly);
|
||||||
stream.setCodec(codec);
|
stream.setCodec(codec);
|
||||||
|
uchardet_delete(chardet);
|
||||||
|
|
||||||
textcontent = stream.readAll().replace("\n","");
|
textcontent = stream.readAll().replace("\n","");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue