Problem with some characters in wxURI

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
jimmiejams
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Sep 20, 2018 7:16 am

Problem with some characters in wxURI

Post by jimmiejams »

Hi,

We have a GUI program that had been running on wxWidgets-2.8.12 on Mac without a problem, but now that we've moved to 3.0.3 we're hitting problems opening ZIP files with Brazillian Portgueuse characters in the filename. An example would be something like this:

Code: Select all

wxString filename = ".../MoldurasPadrão1.mpk";
wxString base = filename + "#zip:);
wxString path = "element.txt";
wxFileSystem fs;
FSFile *fsf = fs.OpenFile (base + path);
This then raises an assert in wxUniChar::ToHi8bit() saying "character cannot be converted to single byte". I've narrowed it down to just this example:

Code: Select all

#include <wx/app.h>
#include <wx/string.h>
#include <wx/uri.h>

class MyApp : public wxApp {
    bool OnInit (void) {
        wxString path = wxURI::Unescape  ("MoldurasPadrão1.mpk");
        return false;
    }
};

wxIMPLEMENT_APP (MyApp);
Our wxWidgets is compiled using the following configure options:

Code: Select all

configure --with-macosx-version-min=10.9 --enable-compat26 --disable-shared --enable-stl --enable-debug --with-flavour=debug
I can provide the full output from configure if it helps. The compiler is clang from Xcode 9.4.1 on macOS 10.13.6.

The strange this is, if I just compile and run this, I don't get an assert, which makes me think maybe we're not intialising something wxWidgets needs in the GUI version.

Code: Select all

#include <wx/string.h>
#include <wx/uri.h>

int main (void)
{
    wxString path = wxURI::Unescape  ("MoldurasPadrão1.mpk");
    return 0;
}
Can anyone reproduce this problem on macOS?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Problem with some characters in wxURI

Post by ONEEYEMAN »

Hi,
Did you try to recompile the wxWidgets with "--enable-unicode"?
I don't know if this will be set on Mac with non-default configure...

Thank you.
jimmiejams
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Sep 20, 2018 7:16 am

Re: Problem with some characters in wxURI

Post by jimmiejams »

Hi,

Thanks, I gave that a go just now, but no improvement I'm afraid. I'll try a more stock compilation of wxWidgets next, and see if that makes any difference.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Problem with some characters in wxURI

Post by ONEEYEMAN »

Hi,
In you sample can you step through in the Unescape() method and see what happens?

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

Re: Problem with some characters in wxURI

Post by doublemax »

wxURI::Unescape("MoldurasPadrão1.mpk");
By my definition this is not a valid URI, as it contains a non-ascii character. (Although it works under Windows).

How is that related to the ZIP problem? Is wxURI::Unescape used in the ZIP processing somewhere?
Use the source, Luke!
Post Reply