* eword-decode.el (eword-decode-field-body): New function.
authorakr <akr>
Sun, 25 Oct 1998 02:29:35 +0000 (02:29 +0000)
committerakr <akr>
Sun, 25 Oct 1998 02:29:35 +0000 (02:29 +0000)
(eword-decode-header): Use `eword-decode-field-body'.

* mmgeneric.el (mime-insert-header-from-buffer): Use
`eword-decode-field-body'.

ChangeLog
eword-decode.el
mmgeneric.el

index 8b88526..5f4648b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-Sun Oct 25 01:37:34 GMT 1998
+1998-10-25  Tanaka Akira  <akr@jaist.ac.jp>
+
+       * eword-decode.el (eword-decode-field-body): New function.
+       (eword-decode-header): Use `eword-decode-field-body'.
+
+       * mmgeneric.el (mime-insert-header-from-buffer): Use
+       `eword-decode-field-body'.
+
 1998-10-25  Tanaka Akira  <akr@jaist.ac.jp>
 
        * eword-encode.el (eword-encode-field-body): New function.
index 8688d08..e3f49e4 100644 (file)
@@ -315,7 +315,7 @@ Anyway, non-encoded-word part is decoded with `default-mime-charset'."
   (when (eq max-column t)
     (setq max-column fill-column))
   (let ((field-name-symbol (intern (capitalize field-name)))
-       (len (string-width field-name)))
+       (len (1+ (string-width field-name))))
     (if (memq field-name-symbol eword-decode-ignored-field-list)
        ;; Don't decode
        (if max-column
@@ -350,36 +350,17 @@ If SEPARATOR is not nil, it is used as header separator."
                      code-conversion
                    default-mime-charset))))
        (if default-charset
-           (let (beg p end field-name len)
+           (let (beg p end field-name field-body)
              (goto-char (point-min))
              (while (re-search-forward std11-field-head-regexp nil t)
                (setq beg (match-beginning 0)
                      p (match-end 0)
                      field-name (buffer-substring beg (1- p))
-                     len (string-width field-name)
-                     field-name (intern (capitalize field-name))
+                     field-body (buffer-substring p end)
                      end (std11-field-end))
-               (cond ((memq field-name eword-decode-ignored-field-list)
-                      ;; Don't decode
-                      )
-                     ((memq field-name eword-decode-structured-field-list)
-                      ;; Decode as structured field
-                      (let ((body (buffer-substring p end))
-                            (default-mime-charset default-charset))
-                        (delete-region p end)
-                        (insert (eword-decode-and-fold-structured-field
-                                 body (1+ len)))
-                        ))
-                     (t
-                      ;; Decode as unstructured field
-                      (save-restriction
-                        (narrow-to-region beg (1+ end))
-                        (decode-mime-charset-region p end default-charset)
-                        (goto-char p)
-                        (if (re-search-forward eword-encoded-word-regexp
-                                               nil t)
-                            (eword-decode-region beg (point-max) 'unfold))
-                        )))))
+               (delete-region p end)
+               (insert (eword-decode-field-body
+                        field-name field-body nil t))))
          (eword-decode-region (point-min) (point-max) t)
          )))))
 
index 6d67b99..df62c4e 100644 (file)
                                              &optional invisible-fields
                                              visible-fields)
   (let ((the-buf (current-buffer))
-       f-b p f-e field-name len field field-body)
+       f-b p f-e field-name field field-body)
     (save-excursion
       (set-buffer buffer)
       (save-restriction
          (setq f-b (match-beginning 0)
                p (match-end 0)
                field-name (buffer-substring f-b p)
-               len (string-width field-name)
                f-e (std11-field-end))
          (when (mime-visible-field-p field-name
                                      visible-fields invisible-fields)
-           (setq field (intern
-                        (capitalize (buffer-substring f-b (1- p))))
+           (setq field (buffer-substring f-b (1- p))
                  field-body (buffer-substring p f-e))
            (with-current-buffer the-buf
              (insert field-name)
-             (insert
-              (if (memq field eword-decode-ignored-field-list)
-                  ;; Don't decode
-                  field-body
-                (if (memq field eword-decode-structured-field-list)
-                    ;; Decode as structured field
-                    (eword-decode-and-fold-structured-field field-body len)
-                  ;; Decode as unstructured field
-                  (eword-decode-unstructured-field-body field-body len)
-                  )))
+             (insert (eword-decode-field-body field field-body nil t))
              (insert "\n")
              )))))))