mirror of
https://github.com/kiwix/libkiwix.git
synced 2026-02-26 19:26:08 -05:00
Dropped the 2nd param of urlEncode()
`urlEncode(str)` is now equivalent to the previous `urlEncode(str, true)`.
This commit is contained in:
@@ -164,9 +164,6 @@ std::string kiwix::encodeDiples(const std::string& str)
|
||||
namespace
|
||||
{
|
||||
|
||||
/* urlEncode() based on javascript encodeURI() &
|
||||
encodeURIComponent(). Mostly code from rstudio/httpuv (GPLv3) */
|
||||
|
||||
bool isReservedUrlChar(char c)
|
||||
{
|
||||
switch (c) {
|
||||
@@ -246,7 +243,7 @@ int hexToInt(char c) {
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
std::string kiwix::urlEncode(const std::string& value, bool encodeReserved)
|
||||
std::string kiwix::urlEncode(const std::string& value)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << std::hex << std::uppercase;
|
||||
@@ -254,7 +251,7 @@ std::string kiwix::urlEncode(const std::string& value, bool encodeReserved)
|
||||
it != value.end();
|
||||
it++) {
|
||||
|
||||
if (!needsEscape(*it, encodeReserved)) {
|
||||
if (!needsEscape(*it, true)) {
|
||||
os << *it;
|
||||
} else {
|
||||
const unsigned int charVal = static_cast<unsigned char>(*it);
|
||||
|
||||
Reference in New Issue
Block a user