URL Encoding Topic is solved

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
cd_hodges
Earned some good credits
Earned some good credits
Posts: 145
Joined: Thu Feb 03, 2005 4:46 pm

URL Encoding

Post by cd_hodges » Thu Jul 20, 2006 6:39 pm

Hello:

Does anyone know if wxWidgets provides a way to take a string and add the special encoding necessary for a URL. For example if I'm sending something like this:

http://www.mysite.com/up.php?access=dos ... ddress=100 Oak #30&address2=2nd Floor

The "#" sign is considered an unsafe character and will cause problems unless it is encoded.

Any ideas?

Thanks a bunch.

Chris

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Thu Jul 20, 2006 6:53 pm

Did you try to use wxURI?

Code: Select all

wxURI url (wxT("http://www.mysite.com/up.php?access=dosomething&address=100 Oak #30&address2=2nd Floor"));
wxString encoded_url = url.BuildURI();

Cees
In need of some credit
In need of some credit
Posts: 2
Joined: Mon Apr 30, 2007 1:02 pm

Problem with wxURI.Create() and unusal filenames

Post by Cees » Mon Apr 30, 2007 1:36 pm

wxURI tries to encode url's, but gives unexpected results when offering a input string that looks like it is already encoded, example:

- input ftp://my_site/some_folder/%%3B3B93B93C1D9%%_myfile.php
(note: names like these are used by Smarty for certain files)

- wxURI assumes the "%3B" is already encode (which it isn't really) and makes something like:
.../%25%3B....
while it should have been:
.../%25%253B....

I suppose that because "%3B" looks like an encoded character, wxURI is not touching it.

Could this be a bug in wxURI, or is it perhaps a shortcoming that you can not force wxURI.Create() to assume the offered string is not encoded?

Post Reply