Adapted from https://stackoverflow.com/a/29962178/3848666
| 56 | |
| 57 | // Adapted from https://stackoverflow.com/a/29962178/3848666 |
| 58 | std::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 |
no outgoing calls
no test coverage detected