I am writing a program, that has a small, self-written HTTP Server inside. Now i get Data via POST over the socket. My problem is, how do I unescape the String the best way in C++? I get Data like:
command=foo%26bar
but i want it to be
command=foo&bar
Whats the best way to achieve this in C++?
EDIT: If someone is interested in my solution, here it is:
void HttpServer::UnescapePostData(std::string & data) {
    size_t pos;    
    while ((pos = data.find("+")) != std::string::npos) {
        data.replace(pos, 1, " ");
    }
    while ((pos = data.find("%")) != std::string::npos) {
        if (pos <= data.length() - 3) {
            char replace[2] = {(char)(std::stoi("0x" + data.substr(pos+1,2), NULL, 16)), '\0'};
            data.replace(pos, 3, replace);
        }
    }
}
 
    