diff options
Diffstat (limited to '')
-rw-r--r-- | src/utility/urlUtils.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/utility/urlUtils.cpp b/src/utility/urlUtils.cpp index 4fde4916..0a0bfce0 100644 --- a/src/utility/urlUtils.cpp +++ b/src/utility/urlUtils.cpp @@ -27,6 +27,10 @@ namespace utility { const string urlUtils::encode(const string& s) { + static const string RESERVED_CHARS = + /* reserved */ "$&+,/:;=?@" + /* unsafe */ "<>#%{}[]|\\^\"~`"; + string result; result.reserve(s.length()); @@ -35,8 +39,8 @@ const string urlUtils::encode(const string& s) const char_t c = *it; if (parserHelpers::isPrint(c) && !parserHelpers::isSpace(c) && - c != '%' && c != '=' && c != '?' && c != '&' && - c != '@' && c != '/' && c != ':') + static_cast <unsigned char>(c) <= 127 && + RESERVED_CHARS.find(c) == string::npos) { result += c; } |