/[emacs]/emacs/lisp/gnus/qp.el
ViewVC logotype

Diff of /emacs/lisp/gnus/qp.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12.2.2 by miles, Tue Oct 14 23:34:51 2003 UTC revision 1.12.2.3 by miles, Thu Sep 16 00:12:16 2004 UTC
# Line 1  Line 1 
1  ;;; qp.el --- Quoted-Printable functions  ;;; qp.el --- Quoted-Printable functions
2    
3  ;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.  ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4    
5  ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>  ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6  ;; Keywords: mail, extensions  ;; Keywords: mail, extensions
# Line 32  Line 32 
32  (require 'mm-util)  (require 'mm-util)
33  (eval-when-compile (defvar mm-use-ultra-safe-encoding))  (eval-when-compile (defvar mm-use-ultra-safe-encoding))
34    
35    ;;;###autoload
36  (defun quoted-printable-decode-region (from to &optional coding-system)  (defun quoted-printable-decode-region (from to &optional coding-system)
37    "Decode quoted-printable in the region between FROM and TO, per RFC 2045.    "Decode quoted-printable in the region between FROM and TO, per RFC 2045.
38  If CODING-SYSTEM is non-nil, decode bytes into characters with that  If CODING-SYSTEM is non-nil, decode bytes into characters with that
39  coding-system.  coding-system.
40    
41  Interactively, you can supply the CODING-SYSTEM argument  Interactively, you can supply the CODING-SYSTEM argument
42  with \\[universal-coding-system-argument]."  with \\[universal-coding-system-argument].
43    
44    The CODING-SYSTEM argument is a historical hangover and is deprecated.
45    QP encodes raw bytes and should be decoded into raw bytes.  Decoding
46    them into characters should be done separately."
47    (interactive    (interactive
48     ;; Let the user determine the coding system with "C-x RET c".     ;; Let the user determine the coding system with "C-x RET c".
49     (list (region-beginning) (region-end) coding-system-for-read))     (list (region-beginning) (region-end) coding-system-for-read))
# Line 67  with \\[universal-coding-system-argument Line 72  with \\[universal-coding-system-argument
72                                                                (+ 3 (point)))                                                                (+ 3 (point)))
73                                              16)))                                              16)))
74                     (mm-insert-byte byte 1)                     (mm-insert-byte byte 1)
75                     (delete-char 3)                     (delete-char 3)))
                    (unless (eq byte ?=)  
                      (backward-char))))  
76                  (t                  (t
77                   (error "Malformed quoted-printable text")                   (message "Malformed quoted-printable text")
78                   (forward-char)))))                   (forward-char)))))
79        (if coding-system        (if coding-system
80            (mm-decode-coding-region (point-min) (point-max) coding-system)))))            (mm-decode-coding-region (point-min) (point-max) coding-system)))))
81    
82  (defun quoted-printable-decode-string (string &optional coding-system)  (defun quoted-printable-decode-string (string &optional coding-system)
83    "Decode the quoted-printable encoded STRING and return the result.    "Decode the quoted-printable encoded STRING and return the result.
84  If CODING-SYSTEM is non-nil, decode the region with coding-system."  If CODING-SYSTEM is non-nil, decode the region with coding-system.
85    (with-temp-buffer  Use of CODING-SYSTEM is deprecated; this function should deal with
86    raw bytes, and coding conversion should be done separately."
87      (mm-with-unibyte-buffer
88      (insert string)      (insert string)
89      (quoted-printable-decode-region (point-min) (point-max) coding-system)      (quoted-printable-decode-region (point-min) (point-max) coding-system)
90      (buffer-string)))      (buffer-string)))

Legend:
Removed from v.1.12.2.2  
changed lines
  Added in v.1.12.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26