about summary refs log tree commit diff stats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/twtstr.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 6f324f49..df8cfa6e 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -411,6 +411,11 @@ const PathPercentEncodeSet* = (QueryPercentEncodeSet + {'?', '`', '{', '}'})
 const UserInfoPercentEncodeSet* = (PathPercentEncodeSet + {'/', ':', ';', '=', '@', '['..'^', '|'})
 const ComponentPercentEncodeSet* = (UserInfoPercentEncodeSet + {'$'..'&', '+', ','})
 const ApplicationXWWWFormUrlEncodedSet* = (ComponentPercentEncodeSet + {'!', '\''..')', '~'})
+# used by client
+when defined(windows) or defined(OS2) or defined(DOS):
+  const LocalPathPercentEncodeSet* = (QueryPercentEncodeSet + {'?', ':'})
+else:
+  const LocalPathPercentEncodeSet* = (QueryPercentEncodeSet + {'?', ':', '\\'})
 
 proc percentEncode*(append: var string, c: char, set: set[char], spaceAsPlus = false) {.inline.} =
   if spaceAsPlus and c == ' ':
@@ -428,6 +433,9 @@ proc percentEncode*(append: var string, s: string, set: set[char], spaceAsPlus =
 func percentEncode*(c: char, set: set[char]): string {.inline.} =
   result.percentEncode(c, set)
 
+func percentEncode*(s: string, set: set[char]): string =
+  result.percentEncode(s, set)
+
 func percentDecode*(input: string): string =
   var i = 0
   while i < input.len: