mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07:00
Fix #96
This commit is contained in:
parent
abf79d5a38
commit
d32eee7627
1 changed files with 3 additions and 2 deletions
|
@ -923,10 +923,11 @@ inline std::string encode_url(const std::string& s)
|
|||
case ':': result += "%3A"; break;
|
||||
case ';': result += "%3B"; break;
|
||||
default:
|
||||
if (s[i] < 0) {
|
||||
auto c = static_cast<uint8_t>(s[i]);
|
||||
if (c >= 0x80) {
|
||||
result += '%';
|
||||
char hex[4];
|
||||
size_t len = snprintf(hex, sizeof(hex) - 1, "%02X", (unsigned char)s[i]);
|
||||
size_t len = snprintf(hex, sizeof(hex) - 1, "%02X", c);
|
||||
assert(len == 2);
|
||||
result.append(hex, len);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue