E
E
evilandfox2016-06-16 21:38:17
Qt
evilandfox, 2016-06-16 21:38:17

How to properly display an archive file in Cyrillic on QuaZIP?

I am using QuaZIP in a project. I get a list of archive files through JlCompress::getFileList(zipFile);, they are displayed as:

"ѓќ‘Ќ/‘Ў®а\u00ADЁЄЁ \u00AD  ¬®\u00ADв ¦ ®Ў®а㤮ў \u00ADЁп/"

How to fix? I think the problem is in Qt itself, and not in the library itself

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
evilandfox, 2016-06-16
@evilandfox

I accidentally solved the problem. I bring the code:

QTextDecoder *decoder = QTextCodec::codecForName("cp866")->makeDecoder(QTextCodec::IgnoreHeader);
QString badString = "ѓќ‘Ќ/‘Ў®а\u00ADЁЄЁ \u00AD  ¬®\u00ADв ¦ ®Ў®а㤮ў \u00ADЁп/";
QString correctString = decoder->toUnicode(badString.toLocal8Bit());
qDebug() << correctString; //выведет "ГЭСН/Сборники на монтаж оборудования/"

I'm not sure about cross-platform
It took more functionality from the library, as a result I started using the QuaZip class itself. And there the problem is solved simply:
QuaZip *zip = new QuaZip();
zip->setFileNameCodec("IBM866");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question