MCPcopy Create free account
hub / github.com/aixed/WeChat-Hook / encode_query_param

Function encode_query_param

include/httplib.h:2149–2168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2147}
2148
2149inline std::string encode_query_param(const std::string &value) {
2150 std::ostringstream escaped;
2151 escaped.fill('0');
2152 escaped << std::hex;
2153
2154 for (auto c : value) {
2155 if (std::isalnum(static_cast<uint8_t>(c)) || c == '-' || c == '_' ||
2156 c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' ||
2157 c == ')') {
2158 escaped << c;
2159 } else {
2160 escaped << std::uppercase;
2161 escaped << '%' << std::setw(2)
2162 << static_cast<int>(static_cast<unsigned char>(c));
2163 escaped << std::nouppercase;
2164 }
2165 }
2166
2167 return escaped.str();
2168}
2169
2170inline std::string encode_url(const std::string &s) {
2171 std::string result;

Callers 1

params_to_query_strFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected