From d32eee76274d9c8f7e3c6b690b3de53ff8445e81 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sun, 30 Sep 2018 08:40:31 -0400 Subject: [PATCH] Fix #96 --- httplib.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/httplib.h b/httplib.h index f3115f9..142ae54 100644 --- a/httplib.h +++ b/httplib.h @@ -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(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 {