diff --git a/Common/StringUtil.cpp b/Common/StringUtil.cpp index 0e7f2072..01398a9e 100644 --- a/Common/StringUtil.cpp +++ b/Common/StringUtil.cpp @@ -78,7 +78,7 @@ void EscapeRegExp(std::wstring& str) /* ** Escapes reserved URL characters. */ -void EscapeUrl(std::wstring& str) +void EncodeUrl(std::wstring& str) { size_t pos = 0; while ((pos = str.find_first_of(L" !*'();:@&=+$,/?#[]", pos)) != std::wstring::npos) diff --git a/Common/StringUtil.h b/Common/StringUtil.h index b0178008..50c503ba 100644 --- a/Common/StringUtil.h +++ b/Common/StringUtil.h @@ -38,7 +38,7 @@ inline std::wstring WidenUTF8(const std::string& str) { return Widen(str.c_str() void EscapeRegExp(std::wstring& str); -void EscapeUrl(std::wstring& str); +void EncodeUrl(std::wstring& str); } // namespace StringUtil diff --git a/Common/StringUtil_Test.cpp b/Common/StringUtil_Test.cpp index 16dcbee3..db43c998 100644 --- a/Common/StringUtil_Test.cpp +++ b/Common/StringUtil_Test.cpp @@ -47,10 +47,10 @@ public: Assert::AreEqual(L"\\\\\\^\\$\\|\\(test\\)\\[\\{\\. ing\\+\\*\\?", str.c_str()); } - TEST_METHOD(TestEscapeUrl) + TEST_METHOD(TestEncodeUrl) { std::wstring str = L" !*'();:@test&=+$,/?#[ing]"; - EscapeUrl(str); + EncodeUrl(str); Assert::AreEqual(L"%20%21%2A%27%28%29%3B%3A%40test%26%3D%2B%24%2C%2F%3F%23%5Bing%5D", str.c_str()); } }; diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index 819e42e2..b8ff8271 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -238,7 +238,7 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s Max, Min, EscapeRegExp, - EscapeUrl + EncodeUrl } valueType = ValueType::Raw; if (isKeySelector) @@ -255,9 +255,9 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s { valueType = ValueType::EscapeRegExp; } - else if (_wcsicmp(selectorSz, L"EscapeUrl") == 0) + else if (_wcsicmp(selectorSz, L"EncodeUrl") == 0) { - valueType = ValueType::EscapeUrl; + valueType = ValueType::EncodeUrl; } else { @@ -304,10 +304,10 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s StringUtil::EscapeRegExp(strValue); return true; } - else if (valueType == ValueType::EscapeUrl) + else if (valueType == ValueType::EncodeUrl) { strValue = measure->GetStringValue(); - StringUtil::EscapeUrl(strValue); + StringUtil::EncodeUrl(strValue); return true; }