X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src.lisp;h=ba471ca7e9ae02bc3c1886f6c50e4478d6ca2989;hb=a271a51355dee9dee25210677f9ef43533550951;hp=8aee8122340183fdfb234e4e2119bb785c9dfebb;hpb=a12c7dce4427ac5a77ebcd4d295a4b18ab7f5cbc;p=puri-unicode.git diff --git a/src.lisp b/src.lisp index 8aee812..ba471ca 100644 --- a/src.lisp +++ b/src.lisp @@ -837,13 +837,19 @@ URI ~s contains illegal character ~s at position ~d." (push (if rpos (with-output-to-string (out) (loop for ch across decoded-string - for i from curpos by 3 + with i = curpos do (let ((octet (char-code ch))) - (if (or (null reserved-chars) - (> octet 127) - (= (sbit reserved-chars octet) 0)) - (write-char ch out) - (write-string (subseq string i (+ i 3)) out))))) + (cond + ((or (null reserved-chars) + (> octet 127) + (= (sbit reserved-chars octet) 0)) + (write-char ch out) + (incf i + (* (if (> octet 127) 2 1) + 3))) + (t (write-string (subseq string i (+ i 3)) out) + (incf i 3) + ))))) decoded-string) strs)))) (setf curpos pos))))