diff options
author | Vincent Richard <[email protected]> | 2006-01-31 19:09:43 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2006-01-31 19:09:43 +0000 |
commit | 64235edb41c1c85ed32211fc719e6a7d65f5daf0 (patch) | |
tree | 3fd29ab1514fcd55e08fd8ff5889eb59743c6d8d /src/utility/urlUtils.cpp | |
parent | Added service::isSecuredConnection() and service::getConnectionInfos() to ret... (diff) | |
download | vmime-64235edb41c1c85ed32211fc719e6a7d65f5daf0.tar.gz vmime-64235edb41c1c85ed32211fc719e6a7d65f5daf0.zip |
Fixed encoding of reserved/unsafe chars.
Diffstat (limited to 'src/utility/urlUtils.cpp')
-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; } |