diff options
| author | Dave Love | 2002-10-18 10:43:12 +0000 |
|---|---|---|
| committer | Dave Love | 2002-10-18 10:43:12 +0000 |
| commit | 5f8dd322a925dd06b357adb73d9e68ef358e9c76 (patch) | |
| tree | 64cc1b5f3d146373c59494b2910d7df3d181be98 | |
| parent | d9c25020a03cfa212e61afc0274310e55b1b3932 (diff) | |
| download | emacs-5f8dd322a925dd06b357adb73d9e68ef358e9c76.tar.gz emacs-5f8dd322a925dd06b357adb73d9e68ef358e9c76.zip | |
(quoted-printable-encode-region): Use mm-insert-byte.
Maybe use string-to-multibyte. Avoid find-charset-region. Cope
with encoding Emacs 22 eight-bit chars.
| -rw-r--r-- | lisp/gnus/qp.el | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lisp/gnus/qp.el b/lisp/gnus/qp.el index 8fd0053a812..50ccf065226 100644 --- a/lisp/gnus/qp.el +++ b/lisp/gnus/qp.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; qp.el --- Quoted-Printable functions | 1 | ;;; qp.el --- Quoted-Printable functions |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> | 5 | ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 6 | ;; Keywords: mail, extensions | 6 | ;; Keywords: mail, extensions |
| @@ -66,7 +66,7 @@ with \\[universal-coding-system-argument]." | |||
| 66 | (let ((byte (string-to-int (buffer-substring (1+ (point)) | 66 | (let ((byte (string-to-int (buffer-substring (1+ (point)) |
| 67 | (+ 3 (point))) | 67 | (+ 3 (point))) |
| 68 | 16))) | 68 | 16))) |
| 69 | (insert byte) | 69 | (mm-insert-byte byte 1) |
| 70 | (delete-char 3) | 70 | (delete-char 3) |
| 71 | (unless (eq byte ?=) | 71 | (unless (eq byte ?=) |
| 72 | (backward-char)))) | 72 | (backward-char)))) |
| @@ -95,13 +95,15 @@ You should probably avoid non-ASCII characters in this arg. | |||
| 95 | If `mm-use-ultra-safe-encoding' is set, fold lines unconditionally and | 95 | If `mm-use-ultra-safe-encoding' is set, fold lines unconditionally and |
| 96 | encode lines starting with \"From\"." | 96 | encode lines starting with \"From\"." |
| 97 | (interactive "r") | 97 | (interactive "r") |
| 98 | ;; Fixme: what should this do in XEmacs/Mule? | 98 | (save-excursion |
| 99 | (if (fboundp 'find-charset-region) ; else XEmacs, non-Mule | 99 | (goto-char from) |
| 100 | (if (delq 'unknown ; Emacs 20 unibyte | 100 | (if (fboundp 'string-to-multibyte) ; Emacs 22 |
| 101 | (delq 'eight-bit-graphic ; Emacs 21 | 101 | (if (re-search-forward (string-to-multibyte "[^\x0-\x7f\x80-\xff]") |
| 102 | (delq 'eight-bit-control | 102 | to t) |
| 103 | (delq 'ascii (find-charset-region from to))))) | 103 | ;; Fixme: This is somewhat misleading. |
| 104 | (error "Multibyte character in QP encoding region"))) | 104 | (error "Multibyte character in QP encoding region")) |
| 105 | (if (re-search-forward (mm-string-as-multibyte "[^\0-\377]") to t) | ||
| 106 | (error "Multibyte character in QP encoding region")))) | ||
| 105 | (unless class | 107 | (unless class |
| 106 | ;; Avoid using 8bit characters. = is \075. | 108 | ;; Avoid using 8bit characters. = is \075. |
| 107 | ;; Equivalent to "^\000-\007\013\015-\037\200-\377=" | 109 | ;; Equivalent to "^\000-\007\013\015-\037\200-\377=" |
| @@ -115,7 +117,8 @@ encode lines starting with \"From\"." | |||
| 115 | (not (eobp))) | 117 | (not (eobp))) |
| 116 | (insert | 118 | (insert |
| 117 | (prog1 | 119 | (prog1 |
| 118 | (format "=%02X" (char-after)) | 120 | ;; To unibyte in case of Emacs 22 eight-bit. |
| 121 | (format "=%02X" (mm-multibyte-char-to-unibyte (char-after))) | ||
| 119 | (delete-char 1)))) | 122 | (delete-char 1)))) |
| 120 | ;; Encode white space at the end of lines. | 123 | ;; Encode white space at the end of lines. |
| 121 | (goto-char (point-min)) | 124 | (goto-char (point-min)) |