diff --git a/xplat/Flipper/FlipperURLSerializer.cpp b/xplat/Flipper/FlipperURLSerializer.cpp index 0c298723c..99222f8bb 100644 --- a/xplat/Flipper/FlipperURLSerializer.cpp +++ b/xplat/Flipper/FlipperURLSerializer.cpp @@ -35,7 +35,8 @@ std::string URLSerializer::serialize() { if (key == "csr") { query += Base64::encode(value); } else { - query += url_encode(value); + query += + folly::uriEscape(value, folly::UriEscapeMode::QUERY); } append = true; } @@ -43,29 +44,5 @@ std::string URLSerializer::serialize() { return query; } -std::string URLSerializer::url_encode(const std::string& value) { - std::ostringstream escaped; - escaped.fill('0'); - escaped << std::hex; - - for (std::string::const_iterator i = value.begin(), n = value.end(); i != n; - ++i) { - std::string::value_type c = (*i); - - // Keep alphanumeric and other accepted characters intact - if (std::isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') { - escaped << c; - continue; - } - - // Any other characters are percent-encoded - escaped << std::uppercase; - escaped << '%' << std::setw(2) << int((unsigned char)c); - escaped << std::nouppercase; - } - - return escaped.str(); -} - } // namespace flipper } // namespace facebook