in aws/utils/utils.cc [142:158]
std::string url_encode(const std::string& s) {
static const std::string hex_alphabet = "0123456789ABCDEF";
std::string r;
for (auto c : s) {
bool is_digit = c >= 48 && c <= 57;
bool is_alphabet = (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
bool is_unreserved = c == '-' || c == '~' || c == '_' || c == '.';
if (is_digit || is_alphabet || is_unreserved) {
r += c;
} else {
r += '%';
r += hex_alphabet[c / 16];
r += hex_alphabet[c % 16];
}
}
return r;
}