diff --git a/src/Http/HttpClient.h b/src/Http/HttpClient.h index ffd6b1ac..14d9640c 100644 --- a/src/Http/HttpClient.h +++ b/src/Http/HttpClient.h @@ -53,7 +53,7 @@ public: for(auto &pr : *this){ ret.append(pr.first); ret.append("="); - ret.append(strCoding::UrlUTF8Encode(pr.second)); + ret.append(strCoding::UrlEncode(pr.second)); ret.append("&"); } if(ret.size()){ diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 72a2065c..dd98fe45 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -590,7 +590,7 @@ inline HttpSession::KeyValue HttpSession::makeHttpHeader(bool bClose, int64_t iC } string HttpSession::urlDecode(const string &str){ - auto ret = strCoding::UrlUTF8Decode(str); + auto ret = strCoding::UrlDecode(str); #ifdef _WIN32 GET_CONFIG_AND_REGISTER(string,charSet,Http::kCharSet); bool isGb2312 = !strcasecmp(charSet.data(), "gb2312"); diff --git a/src/Http/strCoding.cpp b/src/Http/strCoding.cpp index c6bd9173..4b5ea07b 100644 --- a/src/Http/strCoding.cpp +++ b/src/Http/strCoding.cpp @@ -68,7 +68,7 @@ char StrToBin(const char *str) return chn; } -string strCoding::UrlUTF8Encode(const string &str) { +string strCoding::UrlEncode(const string &str) { string dd; size_t len = str.size(); for (size_t i = 0; i < len; i++) { @@ -88,7 +88,7 @@ string strCoding::UrlUTF8Encode(const string &str) { } return dd; } -string strCoding::UrlUTF8Decode(const string &str) { +string strCoding::UrlDecode(const string &str) { string output = ""; char tmp[2]; int i = 0, len = str.length(); @@ -111,55 +111,6 @@ string strCoding::UrlUTF8Decode(const string &str) { return output; } -string strCoding::UrlGB2312Encode(const string &str) -{ - string dd; - size_t len = str.size(); - for (size_t i = 0; i> 4, (uint8_t)str[i] % 16); - dd.append(tempbuff); - } - } - return dd; -} - -string strCoding::UrlGB2312Decode(const string &str) -{ - string output = ""; - char tmp[2]; - int i = 0, idx = 0, len = str.length(); - while (i