FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
public static std::string FB::URI::url_decode ( const std::string &  in)
static

Decodes the given urlencoded URL.

std::string decoded = FB::URI::url_decode("http://www.firebreath.org/display/documentation/Mac%20Video%20Tutorial")
Parameters
inurlencoded URL
Returns
std::string raw URL (not encoded)
Since
1.4b1
See Also
url_encode

Definition at line 53 of file URI.cpp.

Referenced by parse_query_data(), and URI().

53  {
54  std::stringstream res;
55  for (size_t i = 0; i < in.size(); ++i) {
56  if (in[i] == '%' && (i + 2) < in.size() && isxdigit(in[i+1]) && isxdigit(in[i+2])) {
57  char buf[3];
58  ++i;
59  buf[0] = in[i++]; buf[1] = in[i]; buf[2] = '\0';
60  res << ((char)strtol(buf, NULL, 16));
61  } else res << in[i];
62  }
63  return res.str();
64 }