aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2004-04-12 04:06:01 +0000
committerStefan Monnier2004-04-12 04:06:01 +0000
commitc6bfe6e7caa64bca676230a5d1b285f3c3654d37 (patch)
tree5727e1ed33e6a1d7091e6ff0025d2da0325abf84
parent61bbdf64e85f2713eb145a639ddcc57aea28e08a (diff)
downloademacs-c6bfe6e7caa64bca676230a5d1b285f3c3654d37.tar.gz
emacs-c6bfe6e7caa64bca676230a5d1b285f3c3654d37.zip
(url-hexify-string): Don't give multibyte error for char <16.
(mail-header-extract): Autoload.
-rw-r--r--lisp/url/url-util.el30
1 files changed, 24 insertions, 6 deletions
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index 1472febd05c..49e805086fb 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -27,6 +27,7 @@
27(require 'url-parse) 27(require 'url-parse)
28(autoload 'timezone-parse-date "timezone") 28(autoload 'timezone-parse-date "timezone")
29(autoload 'timezone-make-date-arpa-standard "timezone") 29(autoload 'timezone-make-date-arpa-standard "timezone")
30(autoload 'mail-header-extract "mailheader")
30 31
31(defvar url-parse-args-syntax-table 32(defvar url-parse-args-syntax-table
32 (copy-syntax-table emacs-lisp-mode-syntax-table) 33 (copy-syntax-table emacs-lisp-mode-syntax-table)
@@ -292,9 +293,28 @@ Will not do anything if url-show-status is nil."
292 (+ 10 (- x ?A))) 293 (+ 10 (- x ?A)))
293 (- x ?0))) 294 (- x ?0)))
294 295
296;; Fixme: Is this definition better, and does it ever matter?
297
298;; (defun url-unhex-string (str &optional allow-newlines)
299;; "Remove %XX, embedded spaces, etc in a url.
300;; If optional second argument ALLOW-NEWLINES is non-nil, then allow the
301;; decoding of carriage returns and line feeds in the string, which is normally
302;; forbidden in URL encoding."
303;; (setq str (or str ""))
304;; (setq str (replace-regexp-in-string "%[[:xdigit:]]\\{2\\}"
305;; (lambda (match)
306;; (string (string-to-number
307;; (substring match 1) 16)))
308;; str t t))
309;; (if allow-newlines
310;; (replace-regexp-in-string "[\n\r]" (lambda (match)
311;; (format "%%%.2X" (aref match 0)))
312;; str t t)
313;; str))
314
295;;;###autoload 315;;;###autoload
296(defun url-unhex-string (str &optional allow-newlines) 316(defun url-unhex-string (str &optional allow-newlines)
297 "Remove %XXX embedded spaces, etc in a url. 317 "Remove %XX embedded spaces, etc in a url.
298If optional second argument ALLOW-NEWLINES is non-nil, then allow the 318If optional second argument ALLOW-NEWLINES is non-nil, then allow the
299decoding of carriage returns and line feeds in the string, which is normally 319decoding of carriage returns and line feeds in the string, which is normally
300forbidden in URL encoding." 320forbidden in URL encoding."
@@ -334,11 +354,9 @@ This is taken from RFC 2396.")
334 (lambda (char) 354 (lambda (char)
335 ;; Fixme: use a char table instead. 355 ;; Fixme: use a char table instead.
336 (if (not (memq char url-unreserved-chars)) 356 (if (not (memq char url-unreserved-chars))
337 (if (< char 16) 357 (if (> char 255)
338 (format "%%0%X" char) 358 (error "Hexifying multibyte character %s" str)
339 (if (> char 255) 359 (format "%%%02X" char))
340 (error "Hexifying multibyte character %s" str))
341 (format "%%%X" char))
342 (char-to-string char))) 360 (char-to-string char)))
343 str "")) 361 str ""))
344 362