Merge from emacs-24; up to 2014-06-03T06:51:18Z!eliz@gnu.org
[bpt/emacs.git] / lisp / gnus / rfc2045.el
CommitLineData
23f87bed 1;;; rfc2045.el --- Functions for decoding rfc2045 headers
c113de23 2
ba318903 3;; Copyright (C) 1998-2014 Free Software Foundation, Inc.
c113de23
GM
4
5;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6;; This file is part of GNU Emacs.
7
5e809f55 8;; GNU Emacs is free software: you can redistribute it and/or modify
c113de23 9;; it under the terms of the GNU General Public License as published by
5e809f55
GM
10;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version.
c113de23
GM
12
13;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5e809f55 15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c113de23
GM
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
5e809f55 19;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
a1506d29 20
d49a4975
DL
21;; RFC 2045 is: "Multipurpose Internet Mail Extensions (MIME) Part
22;; One: Format of Internet Message Bodies".
c113de23
GM
23
24;;; Commentary:
25
26;;; Code:
27
28(require 'ietf-drums)
29
30(defun rfc2045-encode-string (param value)
31 "Return and PARAM=VALUE string encoded according to RFC2045."
32 (if (or (string-match (concat "[" ietf-drums-no-ws-ctl-token "]") value)
33 (string-match (concat "[" ietf-drums-tspecials "]") value)
34 (string-match "[ \n\t]" value)
35 (not (string-match (concat "[" ietf-drums-text-token "]") value)))
36 (concat param "=" (format "%S" value))
37 (concat param "=" value)))
38
39(provide 'rfc2045)
40
41;;; rfc2045.el ends here