On Tue, 2018-05-29 at 13:06 -0700, Vinnie Falco via Boost-users wrote:
Yes, a uri parser/serializer is a planned feature. No timeline on that yet.
FWIW, I have tried some encode/decode at the moment: #include <cctype> #include <ios> #include <iomanip> #include <sstream> #include <stdexcept> #include "uri.hpp" namespace uri { std::string encode(const std::string& input) { std::ostringstream oss; for (auto c : input) { if (std::isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') oss << c; else { oss << "%"; oss << std::hex << std::uppercase << std::setw(2); oss << static_cast<int>(static_cast<unsigned char>(c)); oss << std::nouppercase; } } return oss.str(); } std::string decode(const std::string& input) { std::ostringstream oss; for (auto it = input.cbegin(); it != input.cend(); ) { if (*it != '%') oss << *it++; else { if (input.end() - it < 3) throw std::invalid_argument("truncated string"); const auto substr = input.substr(it - input.begin() + 1, 2); oss << static_cast<char>(std::stoull(substr, nullptr, 16)); it += 3; } } return oss.str(); } } // !uri Regards, -- David