Ignore:
Timestamp:
10/12/08 22:47:40 (12 years ago)
Author:
sjamaan
Message:

Fix uri-encode-string, add testcases for uri-encode-string and uri-decode-string

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/uri-generic/trunk/uri-generic.scm

    r12003 r12139  
    710710   (fold (lambda (c ax)
    711711           (if (p c) (let* ((os (enc c)) 
    712                             (cs (map pct-encode os)))
    713                        (append (concatenate (reverse cs)) ax))
     712                            (cs (pct-encode os)))
     713                       (append (reverse cs) ax))
    714714               (cons c ax)))
    715715         (list) str)))
     
    720720        (loop (quotient i 256) (cons (modulo i 256) lst)))))
    721721
     722(define (pct? c) (char=? c #\%))
    722723
    723724(define (uri-encode-string str)
    724   (let ((clst (uri-string->char-list str)))
    725     (uri-char-list->string 
    726      (char-list-encode reserved-char? (compose integer->octets char->integer) clst))))
     725  (let ((clst (string->list str)))
     726    (uri-char-list->string
     727     (char-list-encode (disjoin pct? reserved-char?) (compose integer->octets char->integer) clst))))
    727728
    728729
Note: See TracChangeset for help on using the changeset viewer.