diff --git a/lib/src/Utilities.cc b/lib/src/Utilities.cc index b27583dc..8e8b21a7 100755 --- a/lib/src/Utilities.cc +++ b/lib/src/Utilities.cc @@ -443,8 +443,8 @@ std::string urlDecode(const char *begin, const char *end) if (!((hex >= 48 && hex <= 57) || //0-9 (hex >= 97 && hex <= 122) || //a-z (hex >= 65 && hex <= 90) || //A-Z - //一些特殊符号及保留字[$-_.+!*'(),] [$&+,/:;=?@] - hex == 0x21 || hex == 0x24 || hex == 0x26 || hex == 0x27 || hex == 0x28 || hex == 0x29 || hex == 0x2a || hex == 0x2b || hex == 0x2c || hex == 0x2d || hex == 0x2e || hex == 0x2f || hex == 0x3A || hex == 0x3B || hex == 0x3D || hex == 0x3f || hex == 0x40 || hex == 0x5f)) + //一些特殊符号及保留字[$-_.+!*'(),] [$&+,/:;?@] + hex == 0x21 || hex == 0x24 || hex == 0x26 || hex == 0x27 || hex == 0x28 || hex == 0x29 || hex == 0x2a || hex == 0x2b || hex == 0x2c || hex == 0x2d || hex == 0x2e || hex == 0x2f || hex == 0x3A || hex == 0x3B || hex == 0x3f || hex == 0x40 || hex == 0x5f)) { result += char(hex); i += 2; diff --git a/lib/tests/UrlCodecTest.cc b/lib/tests/UrlCodecTest.cc index dbff3633..89cc3332 100644 --- a/lib/tests/UrlCodecTest.cc +++ b/lib/tests/UrlCodecTest.cc @@ -8,6 +8,7 @@ int main() std::cout << output << std::endl; auto output2 = drogon::urlDecode(output); std::cout << output2 << std::endl; - std::cout << drogon::urlDecode("k2%3D%E5%AE%89&k1%3D1"); + std::cout << drogon::urlEncode("k2=安&k1=1") << std::endl; + std::cout << drogon::urlDecode("k2%3D%E5%AE%89&k1%3D1") << std::endl; return 0; } \ No newline at end of file