Characters looks like Chinese in zip

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Characters looks like Chinese in zip

Post by dkaip »

Hello. I have made zip file from other zip files.
But characters looks like Chinese in base. What i wrong in code?
I use Mint and zipfiles have all deep e.g. /Εγω/Εγγραφα/ etc.
Thank's
Jim

Code: Select all

    wxFFileOutputStream fileout(zipFile);
    wxZipOutputStream zipout (fileout);
    wxFFileInputStream *in = NULL;
    wxZipEntry *entry=NULL;
    wxFileName *zipname = NULL;
// for all files
    for (size_t i = 0; i != zipfiles.GetCount(); ++i)
    {
        if (in!=NULL)
        {
            delete in;
            in = NULL;
        }
        if (zipname!=NULL)
        {
            delete zipname;
            zipname = NULL;
        }
        in = new wxFFileInputStream(zipfiles[i]);
        zipname = new wxFileName (zipfiles[i]);
        entry = new wxZipEntry(zipname->GetFullPath());
        zipout.PutNextEntry(entry);
        zipout.Write(*(in));
    }
    zipout.CloseEntry();
    zipout.Close();
    fileout.Close();
User avatar
T-Rex
Moderator
Moderator
Posts: 1249
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: Characters looks like Chinese in zip

Post by T-Rex »

what type is zipfiles variable?
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Re: Characters looks like Chinese in zip

Post by dkaip »

wxString

wxArrayString files;
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: Characters looks like Chinese in zip

Post by saifcoder »

is a wxWidgets Unicode build ?
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Characters looks like Chinese in zip

Post by ONEEYEMAN »

Hi,
What is you version of wxWidgets?
There was a fix recently added to prevent exactly this issue. Try to compile Git HEAD and see if the issue persists.

Thank you.
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Re: Characters looks like Chinese in zip

Post by dkaip »

Hi.
Sorry for so time to answer. So many thinks to do ...
I use Mint Linux and Unicode library of wxWidgets 3.0.3
Must download HEAD with command git clone --depth=1 https://github.com/wxWidgets/wxWidgets.git and compile to see if runs ok?
Thank's
Jim.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Characters looks like Chinese in zip

Post by ONEEYEMAN »

Hi,
Use this command:

Code: Select all

git clone --recurse-submodules https://github.com/wxWidgets/wxWidgets.git
then compile with the same set of options and then your application.

Thank you.
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Re: Characters looks like Chinese in zip

Post by dkaip »

Thank you.
I just download wxWidgets 3.0.4, the latest lib and compile it.
Same problem, i send image...
I have already try git clone --recurse-submodules https://github.com/wxWidgets/wxWidgets.git
and nothing in compile.
I will try again.
Thank you
Jim.
Attachments
Επιλογή_117.png
Επιλογή_117.png (57.16 KiB) Viewed 1927 times
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Characters looks like Chinese in zip

Post by doublemax »

Is that a problem with ZIP files that you create in your application and open them in another?
Or does it happen if you open ZIP files in your application that were created in another?

The "bad" characters you see is un-decoded UTF-8. So somewhere either an encoding to UTF8 or a decoding is missing.
Use the source, Luke!
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Re: Characters looks like Chinese in zip

Post by dkaip »

That is a problem with ZIP files that creating in my application.
Somewhere in code must be the wrong.
I have try wxWidgets 3.0.4, the last stable but nothing.
Thank you
Jim.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Characters looks like Chinese in zip

Post by ONEEYEMAN »

Hi,
Did you look at the archive sample? Did you try running it?

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Characters looks like Chinese in zip

Post by doublemax »

The fix ONEEYEMAN mentioned is not included in wx 3.0.4 yet.
https://github.com/wxWidgets/wxWidgets/pull/570/commits

You'll have to get the latest version from GIT as ONEEYEMAN said.

Did you try the created ZIP-file in another program, e.g. 7ZIP?
Use the source, Luke!
Post Reply