Article View: fj.mail
Article #400Re: MIME encoded headers (Re: MIMEでの日本語 (多国語 )メイル )
From: enami tsugutomo
Date: Mon, 20 Jul 1992 08:49
Date: Mon, 20 Jul 1992 08:49
109 lines
5036 bytes
5036 bytes
In article <gP-Bb.ysato@etl.go.jp>,
ysato@etl.go.jp (Yutaka Sato =?ISO-2022-JP?B?GyRAOjRGI0stGyhK?=) writes:
> $B$\$/$O(BEmacs$B%f!<%6$G$J$$$N$G>\$7$/$OCN$i$J$$$N$G$9$,!"$*$=$i$/(BMIME
> $BBP1~(B$B$N(Bmh-e$B$d(Bvm$B$N(BMetamail$B$N%Q%C%A$K$b!"$^$@!"$3$N$h$&$J%3!<%I$O4^$^(B
> $B$l$F$$$J(B$B$$$N$G$O$J$$$+(B(?)$B$H;W$$$^$9!#(B
MIME$BBP1~$7$?(Bmh-e$B$H$+(Bvm$B$J$i(Bencode/decode$B$G$-$J(B$B$$$H$7$g$&$,$J$$(B
$B$h$&$J(B... $B$=$l$H$b30It%3%^%s%I$G$d$C$F$k$N$+$J(B?
> $B$H(B$B$3$m$G!"$3$N%3!<%I$N(Bcopyright$B$O$I$&$J$C$F$$$k$N$G$7$g$&(B?$B$3$l$r(B
> $BI,MW$H$7(B$B$F$$$k?M$O>/$J$/$J$$$H;W$$$^$9!#(BMetamail$B$N(Bcontrib$B$H$7$F(B
> $BG[I[%;%C%H$K$b4^(B$B$a$FLc$($l$P%Y%9%H$@$H;W$$$^$9!#(B
$B$8$c$"(B, GPL$B$K=>$&$H$$$&$3$H$K$7$H$-(B$B$^$9(B. $BKM$,(B0$B$+$i=q$-2<$7$?(B
$B$b$N$J$N$GLdBj$J$$$H;W$$$^$9(B. $B$G$9$+$i2?=h(B$B$K:FG[I[$7$F$b$i$C(B
$B$F$b9=$$$^$;$s(B(GPL$B$NHO0OFb$G(B).
# $B$J$s$F$$$&$[$I$?$$(B$B$=$&$J(Bcode$B$8$c$J$$$H$*$b$&$s$@$1$I(B:). test $BMQ$N(B
# code$B$b$N$3$C$?$^$^$@$7(B...
$B$($J$_(B $B$D$0$H$b(B / $B%=%K!<(B
===================================================================
RCS file: RCS/mime.el,v
retrieving revision 1.5
diff -u -r1.5 mime.el
--- 1.5 1992/07/18 07:52:08
+++ mime.el 1992/07/20 08:40:23
@@ -1,7 +1,33 @@
+;; basic MIME support functions for GNU Emacs.
+;; Copyright (C) 1992 enami tsugutomo (enami@sys.ptg.sony.co.jp)
+
+;; This program will work with GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 1, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;;
+
+;; Now support only following functions:
+;; o base64 encoding/decoding.
+;; o iso-2022-jp charset.
+;; Please send bug report or suggestions to `enami@sys.ptg.sony.co.jp'.
;;
-;; $Id: mime.el,v 1.5 1992/07/18 07:52:08 enami Exp $
+;; $Id: mime.el,v 1.6 1992/07/20 08:40:18 enami Exp $
;;
+(provide 'mime)
+
(defconst mime/tspecials "()<>@,;:\\\"/[]?.=")
(defconst mime/charset-regexp "[A-Za-z0-9!#$%&'*+---^_`{}|~]")
(defconst mime/base64-charset (concat "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -28,6 +54,10 @@
(regexp-quote
mime/encoded-word-end)))
+
+;;
+;; utility functions
+;;
(defun mime/nth-string (s n)
(if (stringp s)
(substring s (match-beginning n) (match-end n))
@@ -38,6 +68,10 @@
(substring str (match-end 0))
(buffer-substring (match-end 0))))
+
+;;
+;; base64 encoding/decoding
+;;
;; (char-to-string (mime/base64-bit-to-char 26))
(defun mime/base64-bit-to-char (n)
(cond ((eq n nil) ?=)
@@ -65,7 +99,7 @@
(error "%d" n))
(setq n (1+ n))))
)
-
+
(defun mime/mask (i n) (logand i (1- (ash 1 n))))
(defun mime/base64-encode-1 (a &optional b &optional c)
(cons (ash a -2)
@@ -96,7 +130,6 @@
(message "%s %s %s" l m n))
)
-
;; (mime/base64-decode-chars ?G ?y ?R ?A)
(defun mime/base64-decode-chars (a b c d)
(apply (function mime/base64-decode-1)
@@ -150,6 +183,7 @@
(defun mime/base64-encode-string (string)
(mime/base64-mapconcat (function mime/base64-encode-chars) 3 string))
+
(defun mime/decode-string (encoding string)
(cond ((string= encoding "B")
(mime/base64-decode-string string))
Technical Details
Message-ID:
<ENAMI.92Jul20174919@kitt.sys.ptg.sony.co.jp>Path:
arc1-ca.pugleaf.net!sparky!uunet!ccut!wnoc-tyo-news!scslwide!wsgw!headgw!ptggw!chihaya!enamiReferences:
<gP-Bb.ysato@etl.go.jp>Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: 106028,a0baa779caac25ca X-Google-Attributes: gid106028,public X-Google-Thread: 1460c1,a0baa779caac25ca X-Google-Attributes: gid1460c1,public X-Google-Thread: ff358,472fb210793f32cf X-Google-Attributes: gidff358,public X-Google-ArrivalTime: 1992-07-19 20:25:02 PST Path: arc1-ca.pugleaf.net!sparky!uunet!ccut!wnoc-tyo-news!scslwide!wsgw!headgw!ptggw!chihaya!enami From: enami@sys.ptg.sony.co.jp (enami tsugutomo) Newsgroups: fj.mail,fj.news.b,fj.editor.emacs Subject: Re: MIME encoded headers (Re: MIMEでの日本語 (多国語 )メイル ) Message-ID: <ENAMI.92Jul20174919@kitt.sys.ptg.sony.co.jp> Date: 20 Jul 92 08:49:19 GMT References: <gP-Bb.ysato@etl.go.jp> Sender: news@sys.ptg.sony.co.jp (Usenet & System) Distribution: fj Organization: Sony Corp. Production Technology Development Grp. R&D Div. Lines: 110 In-Reply-To: ysato@etl.go.jp's message of 18 Jul 92 10:55:29 GMT X-Bytes: 3844