ヘッダ化け対策

Keiichi Suzuki keiichi @ nanap.org
1999年 12月 16日 (木) 12:16:47 JST


>>>>> emacs-mime-ja の No. 00252
>>>>> Message-Id: <fz66xzisvw.wl @ gohome.org> で、
>>>>> "寺西" == Yuuichi Teranishi <teranisi @ gohome.org>さま曰く...

寺西> At 15 Dec 1999 16:44:47 +0900,
寺西> 守岡 知彦 / MORIOKA Tomohiko <tomo @ etl.go.jp> wrote:
>> 
>> 寺西> たぶん、これ↓だと思うのですが、
>> 寺西> [2 eword.gif <image/gif (base64)>]
>> 寺西> これは仕方ないのでしょうか?
>> 
>> 例えば、STD 11 での構文解析に失敗したら非構造化欄として扱うとかはいか
>> がでしょうか?
>> 
>> あとは From 欄を非構造化欄として設定するとか。

下の patch のようなもので良いでしょうか?

寺西> 前者の動作が FLIM で実現される予定はありますでしょうか?

最終的に受け取ってもらえるか(だれに?)は不明ですが、 flim-1_13-rfc2231 の
枝には入れておきます。

-------------- next part --------------
Index: eword-decode.el
===================================================================
RCS file: /hare/cvs/root/flim/eword-decode.el,v
retrieving revision 1.15.2.1.6.1
diff -c -r1.15.2.1.6.1 eword-decode.el
*** eword-decode.el	1999/11/05 06:12:55	1.15.2.1.6.1
--- eword-decode.el	1999/12/16 03:05:16
***************
*** 115,128 ****
  (defun eword-decode-structured-field-body (string
  					   &optional start-column max-column
  					   start)
!   (let ((tokens (eword-lexical-analyze string start 'must-unfold))
! 	(result "")
! 	token)
!     (while tokens
!       (setq token (car tokens))
!       (setq result (concat result (eword-decode-token token)))
!       (setq tokens (cdr tokens)))
!     result))
  
  (defun eword-decode-and-unfold-structured-field-body (string
  						      &optional
--- 115,130 ----
  (defun eword-decode-structured-field-body (string
  					   &optional start-column max-column
  					   start)
!   (let ((tokens (eword-lexical-analyze string start 'must-unfold)))
!     (if (assq 'error tokens)
! 	(eword-decode-unstructured-field-body string start-column max-column)
!       (let ((result "")
! 	    token)
! 	(while tokens
! 	  (setq token (car tokens))
! 	  (setq result (concat result (eword-decode-token token)))
! 	  (setq tokens (cdr tokens)))
! 	result))))
  
  (defun eword-decode-and-unfold-structured-field-body (string
  						      &optional
***************
*** 136,153 ****
  
  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 start '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-and-fold-structured-field-body (string
  						    start-column
--- 138,157 ----
  
  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 start 'must-unfold)))
!     (if (assq 'error tokens)
! 	(eword-decode-unstructured-field-body string start-column max-column)
!       (let ((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-and-fold-structured-field-body (string
  						    start-column
***************
*** 158,189 ****
        string
      (or max-column
  	(setq max-column fill-column))
!     (let ((c start-column)
! 	  (tokens (eword-lexical-analyze string start 'must-unfold))
! 	  (result "")
! 	  token)
!       (while (and (setq token (car tokens))
! 		  (setq tokens (cdr tokens)))
! 	(let* ((type (car token)))
! 	  (if (eq type 'spaces)
! 	      (let* ((next-token (car tokens))
! 		     (next-str (eword-decode-token next-token))
! 		     (next-len (string-width next-str))
! 		     (next-c (+ c next-len 1)))
! 		(if (< next-c max-column)
! 		    (setq result (concat result " " next-str)
! 			  c next-c)
! 		  (setq result (concat result "\n " next-str)
! 			c (1+ next-len)))
! 		(setq tokens (cdr tokens))
! 		)
! 	    (let* ((str (eword-decode-token token)))
! 	      (setq result (concat result str)
! 		    c (+ c (string-width str)))
! 	      ))))
!       (if token
! 	  (concat result (eword-decode-token token))
! 	result))))
  
  (defun eword-decode-unstructured-field-body (string &optional start-column
  						    max-column)
--- 162,196 ----
        string
      (or max-column
  	(setq max-column fill-column))
!     (let ((tokens (eword-lexical-analyze string start 'must-unfold)))
!       (if (assq 'error tokens)
! 	  (eword-decode-unstructured-field-body string start-column
! 						max-column)
! 	(let ((c start-column)
! 	      (result "")
! 	      token)
! 	  (while (and (setq token (car tokens))
! 		      (setq tokens (cdr tokens)))
! 	    (let* ((type (car token)))
! 	      (if (eq type 'spaces)
! 		  (let* ((next-token (car tokens))
! 			 (next-str (eword-decode-token next-token))
! 			 (next-len (string-width next-str))
! 			 (next-c (+ c next-len 1)))
! 		    (if (< next-c max-column)
! 			(setq result (concat result " " next-str)
! 			      c next-c)
! 		      (setq result (concat result "\n " next-str)
! 			    c (1+ next-len)))
! 		    (setq tokens (cdr tokens))
! 		    )
! 		(let* ((str (eword-decode-token token)))
! 		  (setq result (concat result str)
! 			c (+ c (string-width str)))
! 		  ))))
! 	  (if token
! 	      (concat result (eword-decode-token token))
! 	    result))))))
  
  (defun eword-decode-unstructured-field-body (string &optional start-column
  						    max-column)
***************
*** 632,647 ****
    :type '(repeat function))
  
  (defun eword-analyze-quoted-string (string start &optional must-unfold)
!   (let ((p (std11-check-enclosure string ?\" ?\" nil start)))
!     (if p
! 	(cons (cons 'quoted-string
! 		    (decode-mime-charset-string
! 		     (std11-strip-quoted-pair
! 		      (substring string (1+ start) (1- p)))
! 		     default-mime-charset))
! 	      ;;(substring string p))
! 	      p)
!       )))
  
  (defun eword-analyze-domain-literal (string start &optional must-unfold)
    (std11-analyze-domain-literal string start))
--- 639,657 ----
    :type '(repeat function))
  
  (defun eword-analyze-quoted-string (string start &optional must-unfold)
!   (if (eq (aref string start) ?\")
!       (let ((p (std11-check-enclosure string ?\" ?\" nil start)))
! 	(if p
! 	    (cons (cons 'quoted-string
! 			(decode-mime-charset-string
! 			 (std11-strip-quoted-pair
! 			  (substring string (1+ start) (1- p)))
! 			 default-mime-charset))
! 		  ;;(substring string p))
! 		  p)
! 	  (cons (cons 'error (substring string start))
! 		(- (length string) start))
! 	  ))))
  
  (defun eword-analyze-domain-literal (string start &optional must-unfold)
    (std11-analyze-domain-literal string start))
***************
*** 661,668 ****
  	  (cond ((eq chr ?\\)
  		 (setq i (1+ i))
  		 (if (>= i len)
! 		     (throw 'tag nil)
! 		   )
  		 (setq last-str (concat last-str
  					(substring string from (1- i))
  					(char-to-string (aref string i)))
--- 671,680 ----
  	  (cond ((eq chr ?\\)
  		 (setq i (1+ i))
  		 (if (>= i len)
! 		     (throw 'tag (cons
! 				  (cons 'error (substring string start))
! 				  len
! 				  )))
  		 (setq last-str (concat last-str
  					(substring string from (1- i))
  					(char-to-string (aref string i)))
***************
*** 704,711 ****
  			   i (cdr ret)
  			   from i
  			   last-str "")
! 		   (throw 'tag nil)
! 		   ))
  		(t
  		 (setq i (1+ i))
  		 ))
--- 716,725 ----
  			   i (cdr ret)
  			   from i
  			   last-str "")
! 		   (throw 'tag (cons
! 				(cons 'error (substring string start))
! 				len
! 				))))
  		(t
  		 (setq i (1+ i))
  		 ))
-------------- next part --------------

-- 
鈴木圭一 / keiichi @ nanap.org
PGP finger print (DH/DSS)
0B32 B37E 6DE9 3BC1 68A4  4089 7AAF 2B03 ECBD 614B


More information about the Emacs-mime-ja mailing list