]> code.delx.au - gnu-emacs/commitdiff
Don't use mm-with-unibyte-buffer in utf7
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 12 Feb 2016 04:48:49 +0000 (15:48 +1100)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 12 Feb 2016 04:48:49 +0000 (15:48 +1100)
* lisp/gnus/utf7.el (utf7-fragment-encode): Don't use
mm-with-unibyte-buffer.

lisp/gnus/utf7.el

index 2168b7cf67cc72af3dc9a7144e613af1eaabde18..bd04eba2faec5f77e26542ae5377646539306de2 100644 (file)
@@ -119,11 +119,17 @@ Use IMAP modification if FOR-IMAP is non-nil."
   "Encode text from START to END in buffer as UTF-7 escape fragment.
 Use IMAP modification if FOR-IMAP is non-nil."
   (save-restriction
-    (narrow-to-region start end)
-    (funcall (utf7-get-u16char-converter 'to-utf-16))
-    (mm-with-unibyte-current-buffer
-      (base64-encode-region start (point-max)))
-    (goto-char start)
+    (let* ((buf (current-buffer))
+          (base (with-temp-buffer
+                  (set-buffer-multibyte nil)
+                  (insert-buffer-substring buf start end)
+                  (funcall (utf7-get-u16char-converter 'to-utf-16))
+                  (base64-encode-region (point-min) (point-max))
+                  (buffer-string))))
+      (narrow-to-region start end)
+      (delete-region (point-min) (point-max))
+      (insert base))
+    (goto-char (point-min))
     (let ((pm (point-max)))
       (when for-imap
        (while (search-forward "/" nil t)
@@ -186,7 +192,6 @@ Use IMAP modification if FOR-IMAP is non-nil."
   "Convert latin 1 (ISO-8859.1) characters to 16 bit Unicode.
 Characters are converted to raw byte pairs in narrowed buffer."
   (encode-coding-region (point-min) (point-max) 'iso-8859-1)
-  (mm-disable-multibyte)
   (goto-char (point-min))
   (while (not (eobp))
     (insert 0)