]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filesys.cpp
fixing the usage of hishape
[wxWidgets.git] / src / common / filesys.cpp
index 7e6044e4c255a17e614a7807b0c1c163daea889b..038e55407fb989b4b18b83a29f7c535414c3bdaf 100644 (file)
@@ -27,6 +27,7 @@
 #include "wx/mimetype.h"
 #include "wx/filename.h"
 #include "wx/tokenzr.h"
+#include "wx/uri.h"
 #include "wx/private/fileback.h"
 
 // ----------------------------------------------------------------------------
@@ -613,8 +614,7 @@ wxFileName wxFileSystem::URLToFileName(const wxString& url)
         path = path.Mid(2);
 #endif
 
-    path.Replace(wxT("%25"), wxT("%"));
-    path.Replace(wxT("%3A"), wxT(":"));
+    path = wxURI::Unescape(path);
 
 #ifdef __WXMSW__
     // file urls either start with a forward slash (local harddisk),
@@ -661,7 +661,8 @@ wxString wxFileSystem::FileNameToURL(const wxFileName& filename)
 #endif
 
     url.Replace(g_nativePathString, g_unixPathString);
-    url.Replace(wxT("%"), wxT("%25"));
+    url.Replace(wxT("%"), wxT("%25")); // '%'s must be replaced first!
+    url.Replace(wxT("#"), wxT("%23"));
     url.Replace(wxT(":"), wxT("%3A"));
     url = wxT("file:") + url;
     return url;