Skip to content

Commit 41d0624

Browse files
Make strict urlencode the default
1 parent b96d1e9 commit 41d0624

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/stdlib/io/uri.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ def report(uri: String): Unit = {
1515
}
1616
def main() = {
1717
println(urldecode("%2F%20%20!"))
18+
println(urldecode(urlencodePermissive("Hallo Welt!/&^$@^*(&$)(*!_!_+\")")))
19+
println(urlencodePermissive("Hallo Welt!/&^$@^*(&$)(*!_!_+\")"))
1820
println(urldecode(urlencode("Hallo Welt!/&^$@^*(&$)(*!_!_+\")")))
1921
println(urlencode("Hallo Welt!/&^$@^*(&$)(*!_!_+\")"))
20-
println(urldecode(urlencodeStrict("Hallo Welt!/&^$@^*(&$)(*!_!_+\")")))
21-
println(urlencodeStrict("Hallo Welt!/&^$@^*(&$)(*!_!_+\")"))
2222

2323
// examples from the spec
2424
report("ftp://ftp.is.co.za/rfc/rfc1808.txt")

libraries/common/io/uri.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def isSubDelim(c: Char): Bool = c match {
5353
}
5454

5555
/// Encodes the string for urls using %-escapes
56-
def urlencode(s: String): String = urlencode(s){
56+
def urlencodePermissive(s: String): String = urlencode(s){
5757
case '%' => true
5858
case ' ' => true
5959
case c and c.isGenDelim || c.isSubDelim => true
@@ -73,7 +73,7 @@ def isUnreserved(c: Char): Bool = c match {
7373
/// Encodes the string for urls using %-escapes,
7474
/// escaping everything that is not an unreserved character
7575
/// as per RFC 3986.
76-
def urlencodeStrict(s: String): String =
76+
def urlencode(s: String): String =
7777
urlencode(s){ c => not(c.isUnreserved) }
7878

7979

0 commit comments

Comments
 (0)