# HG changeset patch # User Dave Love # Date 1034937792 0 # Node ID 03cfc305a0faea3620ae394958fdd41474246c4f # Parent 9f8c520b2a12594497dc0f0868073dd37f35383c (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. diff -r 9f8c520b2a12 -r 03cfc305a0fa lisp/gnus/qp.el --- a/lisp/gnus/qp.el Fri Oct 18 10:11:25 2002 +0000 +++ b/lisp/gnus/qp.el Fri Oct 18 10:43:12 2002 +0000 @@ -1,6 +1,6 @@ ;;; qp.el --- Quoted-Printable functions -;; Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Keywords: mail, extensions @@ -66,7 +66,7 @@ (let ((byte (string-to-int (buffer-substring (1+ (point)) (+ 3 (point))) 16))) - (insert byte) + (mm-insert-byte byte 1) (delete-char 3) (unless (eq byte ?=) (backward-char)))) @@ -95,13 +95,15 @@ If `mm-use-ultra-safe-encoding' is set, fold lines unconditionally and encode lines starting with \"From\"." (interactive "r") - ;; Fixme: what should this do in XEmacs/Mule? - (if (fboundp 'find-charset-region) ; else XEmacs, non-Mule - (if (delq 'unknown ; Emacs 20 unibyte - (delq 'eight-bit-graphic ; Emacs 21 - (delq 'eight-bit-control - (delq 'ascii (find-charset-region from to))))) - (error "Multibyte character in QP encoding region"))) + (save-excursion + (goto-char from) + (if (fboundp 'string-to-multibyte) ; Emacs 22 + (if (re-search-forward (string-to-multibyte "[^\x0-\x7f\x80-\xff]") + to t) + ;; Fixme: This is somewhat misleading. + (error "Multibyte character in QP encoding region")) + (if (re-search-forward (mm-string-as-multibyte "[^\0-\377]") to t) + (error "Multibyte character in QP encoding region")))) (unless class ;; Avoid using 8bit characters. = is \075. ;; Equivalent to "^\000-\007\013\015-\037\200-\377=" @@ -115,7 +117,8 @@ (not (eobp))) (insert (prog1 - (format "=%02X" (char-after)) + ;; To unibyte in case of Emacs 22 eight-bit. + (format "=%02X" (mm-multibyte-char-to-unibyte (char-after))) (delete-char 1)))) ;; Encode white space at the end of lines. (goto-char (point-min))