MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / urlDecode

Function urlDecode

Tactility/Source/network/Url.cpp:58–78  ·  view source on GitHub ↗

Adapted from https://stackoverflow.com/a/29962178/3848666

Source from the content-addressed store, hash-verified

56
57// Adapted from https://stackoverflow.com/a/29962178/3848666
58std::string urlDecode(const std::string& input) {
59 std::string result;
60 size_t conversion_buffer, input_length = input.length();
61
62 for (size_t i = 0; i < input_length; i++) {
63 if (input[i] != '%') {
64 if (input[i] == '+') {
65 result += ' ';
66 } else {
67 result += input[i];
68 }
69 } else {
70 sscanf(input.substr(i + 1, 2).c_str(), "%x", &conversion_buffer);
71 char c = static_cast<char>(conversion_buffer);
72 result += c;
73 i = i + 2;
74 }
75 }
76
77 return result;
78}
79
80} // namespace

Callers 2

UrlTest.cppFile · 0.85
parseUrlQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected