/ is no longer a reserved char for urlEncode()

This change is a quick hack solving known issues with URI-encoding in
libkiwix.

This change removes the slash character from the list of URL separator
symbols in URL encoding/decoding utilities, and makes it a symbol that
is safe to leave unencoded.

Effects:

- `urlEncode()` never encodes the '/' symbol (even when it is requested
  to encode the URL separator symbols too).

- `urlDecode(str)`/`urlDecode(..., false)` will now decode %2F to '/';
  other encoded URL separator symbols are NOT decoded when the second
  argument of `urlDecode()` is set to false (which is the default).
This commit is contained in:
Veloman Yunkan
2023-01-18 16:42:59 +04:00
parent c5ccbd37e2
commit 239b108fa7
3 changed files with 6 additions and 6 deletions

View File

@@ -172,7 +172,6 @@ bool isReservedUrlChar(char c)
switch (c) {
case ';':
case ',':
case '/':
case '?':
case ':':
case '@':
@@ -206,6 +205,7 @@ bool isHarmlessUriChar(char c)
case '\'':
case '(':
case ')':
case '/':
return true;
}
return false;