QTextCodec problems when compressing a Directory with Quazip.



  • Hi,
    I am trying to compress and decompress files with Quazip and all is
    working when I compress and decompress using ENGLISH filenames.The problem
    arizes when I save compress with CHINESE filenames.

    This is my function to compress into a zip.filename comes from a QFileDialog.
    When the filename contains chinese characters the files saves with an unreadable
    scrambled file name like æ•°å­— .I suspect this has sth to do with textCodecs but
    can't pin it out.

    I am having trouble also decompressing files with chinese filenames but I think it
    is related to this.Here is my compressing code that uses Quazip.

    @
    void GKDocExport::exportDocument( QString filename)
    {

    QuaZip zip(filename);
    
    zip.setFileNameCodec("UTF-8");
    
    
    if(!zip.open(QuaZip::mdCreate))
    {
        qWarning("Export failed. Cause: zip.open(): %d", zip.getZipError());
       
        return;
    }
    

    //..........GO ON AND COMPRESS YOUR FILES AND SAVE THEM SOMEWHERE AS A ZIP ARCHIVE.

    }
    @

    I also have to mention that I have these codec settings in my main file:
    @
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    @

    I would appreciate it if somebody helped.
    Thank you for your time.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.