summaryrefslogtreecommitdiff
path: root/lisp/gnus/rfc2231.el
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2006-03-23 05:51:44 +0000
committerKenichi Handa <handa@m17n.org>2006-03-23 05:51:44 +0000
commite9e33c19b8ae7878f448804a54c338a4d83536a1 (patch)
tree2c4f8c5b80c0fade2028293385820ca36029a2a2 /lisp/gnus/rfc2231.el
parent9b99ec0e6c92f9e05f823e2334ca89db6d49c583 (diff)
downloademacs-e9e33c19b8ae7878f448804a54c338a4d83536a1.tar.gz
(rfc2231-decode-encoded-string): Work on unibyte
buffer and then decode the buffer text if necessary. (rfc2231-encode-string): Be sure to work on multibyte buffer at first, and after mm-encode-body, change the buffer to unibyte.
Diffstat (limited to 'lisp/gnus/rfc2231.el')
-rw-r--r--lisp/gnus/rfc2231.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/gnus/rfc2231.el b/lisp/gnus/rfc2231.el
index 2099b20195d..ba246278c73 100644
--- a/lisp/gnus/rfc2231.el
+++ b/lisp/gnus/rfc2231.el
@@ -227,7 +227,7 @@ These look like:
(let ((coding-system (mm-charset-to-coding-system (match-string 2 string)))
;;(language (match-string 3 string))
(value (match-string 4 string)))
- (mm-with-multibyte-buffer
+ (mm-with-unibyte-buffer
(insert value)
(goto-char (point-min))
(while (search-forward "%" nil t)
@@ -236,9 +236,9 @@ These look like:
(string-to-number (buffer-substring (point) (+ (point) 2)) 16)
(delete-region (1- (point)) (+ (point) 2)))))
;; Decode using the charset, if any.
- (unless (memq coding-system '(nil ascii))
- (mm-decode-coding-region (point-min) (point-max) coding-system))
- (buffer-string))))
+ (if (memq coding-system '(nil ascii))
+ (buffer-string)
+ (mm-decode-coding-string (buffer-string) coding-system)))))
(defun rfc2231-encode-string (param value)
"Return and PARAM=VALUE string encoded according to RFC2231.
@@ -252,7 +252,7 @@ the result of this function."
;; Don't make lines exceeding 76 column.
(limit (- 74 (length param)))
spacep encodep charsetp charset broken)
- (with-temp-buffer
+ (mm-with-multibyte-buffer
(insert value)
(goto-char (point-min))
(while (not (eobp))
@@ -268,6 +268,7 @@ the result of this function."
(forward-char 1))
(when charsetp
(setq charset (mm-encode-body)))
+ (set-buffer-multibyte nil)
(cond
((or encodep charsetp
(progn