Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTextCodec problems when compressing a Directory with Quazip.

QTextCodec problems when compressing a Directory with Quazip.

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 967 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • musimbateM Offline
    musimbateM Offline
    musimbate
    wrote on last edited by
    #1

    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.

    Why join the navy if you can be a pirate?-Steve Jobs

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved