Menu

issue opening file with special chars in path (7z.so)

Help
estux
2014-01-28
2014-01-29
  • estux

    estux - 2014-01-28

    Hi,

    I am using 7z.so (7z.dll) in Window, MacOSX and Linux with Qt.

    My code for opening a file is:

    CInFileStream *fileSpec = new CInFileStream;
    ...
    if (!fileSpec->Open((LPCTSTR)filePath.toStdWString().data())) //filePath is a QString, I have used .data() and .c_str()
        //Error opening
    

    This is working fine in Window (32bit) and MacOSX(64bit). I have tested it in Linux (ubuntu 12.04, 13.10 64bit/32bit) and it fails opening any file when the path in "filePath" contains special chars, fe: "/home/myUser/Desktop/file-áéíóú.rar" ("/home/myUser/Desktop/file.rar" is working fine)

    I have compile 7z.so by my self and I also have used the binaries in the p7zip Ubuntu's package.

    Any idea about what is going on here?

     

    Last edit: estux 2014-01-29
  • estux

    estux - 2014-01-29

    I have solved the issue, I was compiling with UNICODE flag enabled and it must be disabled.

    With UNICODE disabled the right code is:

    ...(LPCTSTR)filePath.toStdString().data()...
    
     

    Last edit: estux 2014-01-29

Log in to post a comment.