From 865b0e4c03a90823d39d133949ce259ffcf7916c Mon Sep 17 00:00:00 2001 From: yhirose Date: Sun, 26 Dec 2021 07:53:06 -0500 Subject: [PATCH] Resolve #1145 --- httplib.h | 2 ++ test/test.cc | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/httplib.h b/httplib.h index d4c98e5..159a3a5 100644 --- a/httplib.h +++ b/httplib.h @@ -1661,6 +1661,8 @@ namespace detail { std::string encode_query_param(const std::string &value); +std::string decode_url(const std::string &s, bool convert_plus_to_space); + void read_file(const std::string &path, std::string &out); std::string trim_copy(const std::string &s); diff --git a/test/test.cc b/test/test.cc index f05ef56..28f728d 100644 --- a/test/test.cc +++ b/test/test.cc @@ -58,6 +58,14 @@ TEST(StartupTest, WSAStartup) { } #endif +TEST(DecodeURLTest, PercentCharacter) { + EXPECT_EQ( + detail::decode_url( + R"(descrip=Gastos%20%C3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%B1%C3%91%206)", + false), + R"(descrip=Gastos áéíóúñÑ 6)"); +} + TEST(EncodeQueryParamTest, ParseUnescapedChararactersTest) { string unescapedCharacters = "-_.!~*'()";