]> git.eshelyaron.com Git - emacs.git/commitdiff
(rfc2231-decode-encoded-string): Work on unibyte
authorKenichi Handa <handa@m17n.org>
Thu, 23 Mar 2006 05:51:44 +0000 (05:51 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 23 Mar 2006 05:51:44 +0000 (05:51 +0000)
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.

lisp/gnus/ChangeLog
lisp/gnus/rfc2231.el

index 966451cce3cf505b730a2c8c4fba1eea69c3dca0..50ee745389c2626332ca703b16163d5c7562ece2 100644 (file)
@@ -1,3 +1,10 @@
+2006-03-23  Kenichi Handa  <handa@m17n.org>
+
+       * rfc2231.el (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.
+       
 2006-03-21  Daniel Pittman <daniel@rimspace.net>
 
        * nnimap.el (nnimap-request-update-info-internal): Optimize.
index 2099b20195d617de683b655bb7fb2176ec5b2c9e..ba246278c73b5481413146266ab0d87eb4fcedfd 100644 (file)
@@ -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