Commit 5f3710a2 authored by Glenn Morris's avatar Glenn Morris
Browse files

(utf7-encode, utf7-decode): Use mm-with-multibyte-buffer, or

mm-with-unibyte-buffer, rather than default-enable-multibyte-characters.
parent 9c1cf631
;;; utf7.el --- UTF-7 encoding/decoding for Emacs -*-coding: iso-8859-1;-*- ;;; utf7.el --- UTF-7 encoding/decoding for Emacs -*-coding: iso-8859-1;-*-
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. ;; 2008, 2009 Free Software Foundation, Inc.
;; Author: Jon K Hellan <hellan@acm.org> ;; Author: Jon K Hellan <hellan@acm.org>
;; Maintainer: bugs@gnus.org ;; Maintainer: bugs@gnus.org
...@@ -210,23 +210,21 @@ Characters are in raw byte pairs in narrowed buffer." ...@@ -210,23 +210,21 @@ Characters are in raw byte pairs in narrowed buffer."
(if (and (coding-system-p 'utf-7) (coding-system-p 'utf-7-imap)) (if (and (coding-system-p 'utf-7) (coding-system-p 'utf-7-imap))
;; Emacs 23 with proper support for IMAP ;; Emacs 23 with proper support for IMAP
(encode-coding-string string (if for-imap 'utf-7-imap 'utf-7)) (encode-coding-string string (if for-imap 'utf-7-imap 'utf-7))
(let ((default-enable-multibyte-characters t)) (mm-with-multibyte-buffer
(with-temp-buffer (insert string)
(insert string) (utf7-encode-internal for-imap)
(utf7-encode-internal for-imap) (buffer-string))))
(buffer-string)))))
(defun utf7-decode (string &optional for-imap) (defun utf7-decode (string &optional for-imap)
"Decode UTF-7 STRING. Use IMAP modification if FOR-IMAP is non-nil." "Decode UTF-7 STRING. Use IMAP modification if FOR-IMAP is non-nil."
(if (and (coding-system-p 'utf-7) (coding-system-p 'utf-7-imap)) (if (and (coding-system-p 'utf-7) (coding-system-p 'utf-7-imap))
;; Emacs 23 with proper support for IMAP ;; Emacs 23 with proper support for IMAP
(decode-coding-string string (if for-imap 'utf-7-imap 'utf-7)) (decode-coding-string string (if for-imap 'utf-7-imap 'utf-7))
(let ((default-enable-multibyte-characters nil)) (mm-with-unibyte-buffer
(with-temp-buffer (insert string)
(insert string) (utf7-decode-internal for-imap)
(utf7-decode-internal for-imap) (mm-enable-multibyte)
(mm-enable-multibyte) (buffer-string))))
(buffer-string)))))
(provide 'utf7) (provide 'utf7)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment