# HG changeset patch # User Reiner Steib # Date 1195592795 0 # Node ID 50442c77e2421694932b66956a2b7deefe376a7c # Parent 0d061e2dce738c96b099a54cc2dc53665fee0de2 (utf7-encode, utf7-decode): Use coding system `utf-7'/`utf-7-imap' from utf-7.el' if available. diff -r 0d061e2dce73 -r 50442c77e242 lisp/gnus/ChangeLog --- a/lisp/gnus/ChangeLog Tue Nov 20 20:12:53 2007 +0000 +++ b/lisp/gnus/ChangeLog Tue Nov 20 21:06:35 2007 +0000 @@ -1,5 +1,8 @@ 2007-11-20 Reiner Steib + * utf7.el (utf7-encode, utf7-decode): Use coding system + `utf-7'/`utf-7-imap' from utf-7.el' if available. + * message.el (message-send-mail-function): New function. (message-send-mail-function): Set default using message-send-mail-function. Adjust doc string. diff -r 0d061e2dce73 -r 50442c77e242 lisp/gnus/utf7.el --- a/lisp/gnus/utf7.el Tue Nov 20 20:12:53 2007 +0000 +++ b/lisp/gnus/utf7.el Tue Nov 20 21:06:35 2007 +0000 @@ -209,20 +209,26 @@ (defun utf7-encode (string &optional for-imap) "Encode UTF-7 STRING. Use IMAP modification if FOR-IMAP is non-nil." - (let ((default-enable-multibyte-characters t)) - (with-temp-buffer - (insert string) - (utf7-encode-internal for-imap) - (buffer-string)))) + (if (and (coding-system-p 'utf-7) (coding-system-p 'utf-7-imap)) + ;; Emacs 23 with proper support for IMAP + (encode-coding-string string (if for-imap 'utf-7-imap 'utf-7)) + (let ((default-enable-multibyte-characters t)) + (with-temp-buffer + (insert string) + (utf7-encode-internal for-imap) + (buffer-string))))) (defun utf7-decode (string &optional for-imap) "Decode UTF-7 STRING. Use IMAP modification if FOR-IMAP is non-nil." - (let ((default-enable-multibyte-characters nil)) - (with-temp-buffer - (insert string) - (utf7-decode-internal for-imap) - (mm-enable-multibyte) - (buffer-string)))) + (if (and (coding-system-p 'utf-7) (coding-system-p 'utf-7-imap)) + ;; Emacs 23 with proper support for IMAP + (decode-coding-string string (if for-imap 'utf-7-imap 'utf-7)) + (let ((default-enable-multibyte-characters nil)) + (with-temp-buffer + (insert string) + (utf7-decode-internal for-imap) + (mm-enable-multibyte) + (buffer-string))))) (provide 'utf7)