]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/url.cpp
wxListCtrl::InsertItem returns the index of the inserted item
[wxWidgets.git] / src / common / url.cpp
index a51ee7b2731d0b7511756b8e6e9db92273206154..1e142f1ef1d6215b619e48f7561e3b1a43012c63 100644 (file)
@@ -385,3 +385,30 @@ wxString wxURL::ConvertToValidURI(const wxString& uri)
   return out_str;
 }
 
+wxString wxURL::ConvertFromURI(const wxString& uri)
+{
+  wxString new_uri;
+
+  size_t i = 0;
+  while (i<uri.Len()) {
+    int code;
+    if (uri[i] == _T('%')) {
+      i++;
+      if (uri[i] >= _T('A') && uri[i] <= _T('F'))
+        code = (uri[i] - _T('A') + 10) * 16;
+      else
+        code = (uri[i] - _T('0')) * 16;
+      i++;
+      if (uri[i] >= _T('A') && uri[i] <= _T('F'))
+        code += (uri[i] - _T('A')) + 10;
+      else
+        code += (uri[i] - _T('0'));
+      i++;
+      new_uri += (wxChar)code;
+      continue;
+    }
+    new_uri += uri[i];
+    i++;
+  }
+  return new_uri;
+}