[mew-int 2994] Re: how to post a mew attachment with chinese file name.
jingtao xu
jingtaozf at example.com
Tue May 24 09:38:44 JST 2011
hi mew developer:
I have fixed this question by using rfc2047 encoding by modifying
function "mew-header-insert" in mew-header.el. Here is my modified version
of it.
========================================================
(defvar *mew-header-encoding-method* :rfc2047)
(defun mew-header-insert (key value &optional no-fold)
(if (and value (stringp key))
(let ((beg (point)) params med parname parval)
(when (listp value)
(setq params (cdr value))
(setq value (car value)))
(insert key)
(insert " ")
(setq med (point))
(if (string-match "^[\t -~]*$" value)
(insert value)
(mew-header-encode-text value nil (length key)))
(dolist (par params)
(mew-set '(parname parval) par)
(insert ";")
(cond
((string-match "^[-a-zA-Z0-9]+$" parval)
) ;; do nothing
((and (string= (mew-charset-guess-string parval) mew-us-ascii)
(not (string-match "\"" parval)))
(setq parval (concat "\"" parval "\"")))
(t
(case *mew-header-encoding-method*
(:rfc2047
(when (loop for c across parval
thereis (> c 255))
(setq parval (concat "\"" (rfc2047-encode-string parval)
"\""))))
(t (setq parval (mew-param-encode parval))
(setq parname (concat parname "*"))))))
(insert " " parname "=" parval))
(insert "\n")
(unless no-fold
(mew-header-fold-region beg (point) med)))))
========================================================
Hope this could be merged to the mew.
With best regards,jingtao.
2011/5/11 jingtao xu <jingtaozf at example.com>
> hi mew developer:
> i have used mew for about one year,when i use mew version 6.5beta under
> windows.i could not send out new mail when its attchment name has chinese
> characters,so i redefine following functions like this:
> =============================================
> (defun mew-ecsdb-guess-string (str)
> '((ascii chinese-gb2312) cn-gb-2312 "base64" "B" t))
> =============================================
> this is working,mail.google.com and mew could recognize my email without
> problem.but outlook could not recognize it.
> i found that mew mail header lacks the line "Content-Language: zh-cn", and
> its multiple part is like this:
> =============================================
> Content-Type: Application/Msword;
>
> name*=gb2312''%3D%3Fgb2312%3FB%3Fz%2B7Ev9bcsahf0O2%2BtMzOXzIwMTEwNDI5LmRvYw%3D%3D%3F%3D
> Content-Transfer-Encoding: base64
> Content-Disposition: attachment;
>
> filename*=gb2312''%CF%EE%C4%BF%D6%DC%B1%A8%5F%D0%ED%BE%B4%CC%CE%5F20110429%2Edoc
> =============================================
>
> but outlook's same region is like this:
> =============================================
> Content-Type: application/msword;
> name="=?gb2312?B?z+7Ev9bcsahfwfWx+F8yMDExMDUwNi5kb2M=?="
> Content-Transfer-Encoding: base64
> Content-Disposition: attachment;
> filename="=?gb2312?B?z+7Ev9bcsahfwfWx+F8yMDExMDUwNi5kb2M=?="
> =============================================
>
> could you give me some advise or this is the mew's one bug?
>
> With best regards.
> jingtao
> 2011.5.11
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mew.org/pipermail/mew-int/attachments/20110524/9f142430/attachment.html>
More information about the Mew-int
mailing list