rfc2045.el 1.4 KB

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