comparison lisp/net/browse-url.el @ 84648:ea4647942299

(browse-url-url-encode-chars): Use the right parameter name in the function body. Reported by Johannes Weiner.
author Michaël Cadilhac <michael.cadilhac@lrde.org>
date Wed, 19 Sep 2007 11:21:47 +0000
parents 5c69a4b491f6
children 96e533633b62
comparison
equal deleted inserted replaced
84647:260383892b0f 84648:ea4647942299
620 ;; URL encoding 620 ;; URL encoding
621 621
622 (defun browse-url-url-encode-chars (text chars) 622 (defun browse-url-url-encode-chars (text chars)
623 "URL-encode the chars in TEXT that match CHARS. 623 "URL-encode the chars in TEXT that match CHARS.
624 CHARS is a regexp-like character alternative (e.g., \"[,)$]\")." 624 CHARS is a regexp-like character alternative (e.g., \"[,)$]\")."
625 (let ((encoded-url (copy-sequence url)) 625 (let ((encoded-text (copy-sequence text))
626 (s 0)) 626 (s 0))
627 (while (setq s (string-match chars encoded-url s)) 627 (while (setq s (string-match chars encoded-text s))
628 (setq encoded-url 628 (setq encoded-text
629 (replace-match (format "%%%x" 629 (replace-match (format "%%%x"
630 (string-to-char (match-string 0 encoded-url))) 630 (string-to-char (match-string 0 encoded-text)))
631 t t encoded-url) 631 t t encoded-text)
632 s (1+ s))) 632 s (1+ s)))
633 encoded-url)) 633 encoded-text))
634 634
635 (defun browse-url-encode-url (url) 635 (defun browse-url-encode-url (url)
636 "Escape annoying characters in URL. 636 "Escape annoying characters in URL.
637 The annoying characters are those that can mislead a webbrowser 637 The annoying characters are those that can mislead a webbrowser
638 regarding its parameter treatment. For instance, `,' can 638 regarding its parameter treatment. For instance, `,' can