.
original commit: b8579d5187ee0e3bcd0b0381716777585012dee7
This commit is contained in:
parent
4219499861
commit
23315099d3
|
@ -173,13 +173,11 @@
|
||||||
(define internal-decode
|
(define internal-decode
|
||||||
(match-lambda
|
(match-lambda
|
||||||
[() (list)]
|
[() (list)]
|
||||||
[(#\% char1 char2 . rest)
|
[(#\% (? hex-digit? char1) (? hex-digit? char2) . rest)
|
||||||
;; This used to consult the table again, but I think that's
|
;; This used to consult the table again, but I think that's
|
||||||
;; wrong. For exmaple %2b should produce +, not a space.
|
;; wrong. For exmaple %2b should produce +, not a space.
|
||||||
(let ([num (string->number (string char1 char2) 16)])
|
(cons (string->number (string char1 char2) 16)
|
||||||
(if num
|
(internal-decode rest))]
|
||||||
(cons num (internal-decode rest))
|
|
||||||
(internal-decode rest)))]
|
|
||||||
[(char . rest)
|
[(char . rest)
|
||||||
(cons
|
(cons
|
||||||
(vector-ref table
|
(vector-ref table
|
||||||
|
@ -188,6 +186,11 @@
|
||||||
(bytes->string/utf-8
|
(bytes->string/utf-8
|
||||||
(apply bytes (internal-decode (string->list str)))))
|
(apply bytes (internal-decode (string->list str)))))
|
||||||
|
|
||||||
|
(define (hex-digit? c)
|
||||||
|
(or (char<=? #\0 c #\9)
|
||||||
|
(char<=? #\a c #\f)
|
||||||
|
(char<=? #\A c #\F)))
|
||||||
|
|
||||||
;; string -> string
|
;; string -> string
|
||||||
(define (uri-encode str)
|
(define (uri-encode str)
|
||||||
(encode uri-encoding-vector str))
|
(encode uri-encoding-vector str))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user