Article View: gnu.emacs.vm.bug
Article #610Re: vm-mime-type-converter-alist and charsets
From: Kevin Rodgers
Date: Fri, 05 Mar 2004 17:41
Date: Fri, 05 Mar 2004 17:41
86 lines
4203 bytes
4203 bytes
Silas S. Brown wrote:
> I have this in my init file:
>
> (setq vm-mime-internal-content-type-exceptions '("text/html"))
> (add-to-list 'vm-mime-type-converter-alist
> '("text/html" "text/plain" "lynx -force_html -dump -stdin"))
>
> Unfortunately the result is that messages containing MIME
> types such as
>
> Content-type: text/html; charset=gb2312
>
> are converted into text/plain OK, but the "charset=gb2312"
> part is ignored. (lynx just passes the characters through
> as it gets them, but VM doesn't interpret the gb2312
> characters.)
>
> I think things like "text/html; charset=gb2312" should be
> mapped to "text/plain; charset=gb2312" by the above rule,
> not just to "text/plain". (Obviously it would be awkward to
> specify every single character set as a special case; my
> mail uses rather a lot of them.)
I've been looking at this, to try to come up with a patch for you to
test. vm-mime-type-converter-alist is only referenced by
vm-mime-can-convert, which is only called by
vm-mime-convert-undisplayable-layout and vm-decode-mime-layout (before
it calls vm-mime-convert-undisplayable-layout). And
vm-mime-convert-undisplayable-layout already takes care to preserve the
content type parameters in the layout it returns (even if the lisp is a
little awkward):
(vm-make-layout
'type (append (list (nth 1 ooo)) (cdr (vm-mm-layout-type layout)))
'qtype (append (list (nth 1 ooo)) (cdr (vm-mm-layout-type layout)))
But right above that, it inserts a "Content-Type" header into the work
buffer, without the parameters. So perhaps that's what needs to be
tweaked. Does this patch help?
*** vm-7.18/vm-mime.el.orig Mon Oct 13 13:30:18 2003
--- vm-7.18/vm-mime.el Fri Mar 5 10:29:20 2004
***************
*** 1460,1466 ****
ex)
(throw 'done nil)))
(goto-char (point-min))
! (insert "Content-Type: " (nth 1 ooo) "\n")
(insert "Content-Transfer-Encoding: binary\n\n")
(set-buffer-modified-p nil)
(message "Converting %s to %s... done"
--- 1460,1471 ----
ex)
(throw 'done nil)))
(goto-char (point-min))
! (insert "Content-Type: " (nth 1 ooo)
! (mapconcat (lambda (parameter=value)
! (concat "; " parameter=value))
! (cdr (vm-mm-layout-type layout))
! "")
! "\n")
(insert "Content-Transfer-Encoding: binary\n\n")
(set-buffer-modified-p nil)
(message "Converting %s to %s... done"
***************
*** 1467,1474 ****
(car (vm-mm-layout-type layout))
(nth 1 ooo))
(vm-make-layout
! 'type (append (list (nth 1 ooo)) (cdr (vm-mm-layout-type layout)))
! 'qtype (append (list (nth 1 ooo)) (cdr (vm-mm-layout-type layout)))
'encoding "binary"
'id (vm-mm-layout-id layout)
'description (vm-mm-layout-description layout)
--- 1472,1479 ----
(car (vm-mm-layout-type layout))
(nth 1 ooo))
(vm-make-layout
! 'type (cons (nth 1 ooo) (cdr (vm-mm-layout-type layout)))
! 'qtype (cons (nth 1 ooo) (cdr (vm-mm-layout-type layout)))
'encoding "binary"
'id (vm-mm-layout-id layout)
'description (vm-mm-layout-description layout)
--
Kevin
Technical Details
Message-ID:
<4048BBD5.5090901@yahoo.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mailReferences:
<878yig7e17.fsf@beethoven.homeunix.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6829,f73388c97faae4c X-Google-Attributes: gidf6829,public X-Google-ArrivalTime: 2004-03-05 09:41:32 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mail From: Kevin Rodgers <ihs_4664@yahoo.com> Newsgroups: gnu.emacs.vm.bug Subject: Re: vm-mime-type-converter-alist and charsets Date: Fri, 05 Mar 2004 10:41:41 -0700 Lines: 87 Message-ID: <4048BBD5.5090901@yahoo.com> References: <878yig7e17.fsf@beethoven.homeunix.net> NNTP-Posting-Host: 170.207.51.80 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1078508491 62390486 I 170.207.51.80 ([82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us