in cpp/src/parse.cpp [15:31]
string url_encode(const string &str) {
ostringstream escaped;
escaped.fill('0');
escaped << hex;
for (char c : str) {
if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
escaped << c;
continue;
}
escaped << uppercase;
escaped << '%' << setw(2) << int((unsigned char)c);
escaped << nouppercase;
}
return escaped.str();
}