Function: utf7-fragment-encode

utf7-fragment-encode is a byte-compiled function defined in utf7.el.gz.

Signature

(utf7-fragment-encode START END &optional FOR-IMAP)

Documentation

Encode text from START to END in buffer as UTF-7 escape fragment.

Use IMAP modification if FOR-IMAP is non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/international/utf7.el.gz
(defun utf7-fragment-encode (start end &optional for-imap)
  "Encode text from START to END in buffer as UTF-7 escape fragment.
Use IMAP modification if FOR-IMAP is non-nil."
  (save-restriction
    (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)
	  (replace-match ",")))
      (skip-chars-forward "^= \t\n" pm)
      (delete-region (point) pm))))