From 3e540184092d8d439a954855a997b26fbbcb3df1 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 27 May 2019 12:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpClient.h | 2 +- src/Http/HttpSession.cpp | 2 +- src/Http/strCoding.cpp | 53 ++-------------------------------------- src/Http/strCoding.h | 7 ++---- 4 files changed, 6 insertions(+), 58 deletions(-) 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