From 1ca8642bfb5b49c081dafefb26a006e2245e0dec Mon Sep 17 00:00:00 2001 From: morioka Date: Tue, 17 Feb 1998 13:10:39 +0000 Subject: [PATCH] (eword-decode-and-unfold-structured-field): New function. --- eword-decode.el | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/eword-decode.el b/eword-decode.el index 68d2b18..c59d65b 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -10,7 +10,7 @@ ;; Renamed: 1993/06/03 to tiny-mime.el ;; Renamed: 1995/10/03 from tiny-mime.el (split off encoder) ;; Renamed: 1997/02/22 from tm-ew-d.el -;; Version: $Revision: 1.7 $ +;; Version: $Revision: 1.8 $ ;; Keywords: encoded-word, MIME, multilingual, header, mail, news ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces). @@ -45,7 +45,7 @@ ;;; (defconst eword-decode-RCS-ID - "$Id: eword-decode.el,v 1.7 1998-02-17 13:01:10 morioka Exp $") + "$Id: eword-decode.el,v 1.8 1998-02-17 13:10:39 morioka Exp $") (defconst eword-decode-version (get-version-string eword-decode-RCS-ID)) @@ -506,6 +506,27 @@ such as a version of Net$cape)." )))) result)) +(defun eword-decode-and-unfold-structured-field (string) + "Decode and unfold STRING as structured field body. +It decodes non us-ascii characters in FULL-NAME encoded as +encoded-words or invalid \"raw\" string. \"Raw\" non us-ascii +characters are regarded as variable `default-mime-charset'. + +If an encoded-word is broken or your emacs implementation can not +decode the charset included in it, it is not decoded." + (let ((tokens (eword-lexical-analyze string 'must-unfold)) + (result "")) + (while tokens + (let* ((token (car tokens)) + (type (car token))) + (setq tokens (cdr tokens)) + (setq result + (if (eq type 'spaces) + (concat result " ") + (concat result (eword-decode-token token)) + )))) + result)) + (defun eword-decode-structured-field-body (string &optional must-unfold start-column max-column) "Decode non us-ascii characters in STRING as structured field body. -- 1.7.10.4