🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.vm.bug
Article #471

Re: feature request: B-encoding in headers

#471
From: newsspam5REMOVETHIS
Date: Thu, 05 Jun 2008 20:39
72 lines
4169 bytes
Yuning Feng <fengyuning1984@gmail.com> writes:
> On May 22, 2:51 pm, Yuning Feng <fengyuning1...@gmail.com> wrote:
>> supported also. It seems Gmail requires B-encoding of the subject
>> field for gb2312/gbk (2 charsets for zh-CN, should not limited to
>> those 2) characters to be contained there.
>
> I was wrong. The mail I sent had a bad MIME encoded subject header,
> which is done by VM. It is not VM's fault, however.
>
> The incorrect header was caused by the following expressions in vm-
> rfaddons.el: vm-mime-encode-headers
>
>    (when (and coding (not (eq coding 'no-conversion)))
>      (goto-char end)
>      ;; this is a bug of encode-coding-region, it does not return
>      ;; the right length of the new text, but always 0
>      (let ((old-buffer-size (buffer-size)))
>        (encode-coding-region start end coding)
>        (setq end (+ end (- (buffer-size) old-buffer-size)))))
>
> I was using emacs 23.0.60, and that bug of encoding-coding-region
> seemed to be fixed. As a result, the var "end" was greater than it
> should have been. In my case of testing, the region between "start"
> and "end" was including the end mark "?=" and part of the following
> line.  Then, the end mark "?=" was eaten by vm-mime-Q-encode-region.
>
> Now, I have changed the code to be:
>
>    (when (and coding (not (eq coding 'no-conversion)))
>        (encode-coding-region start end coding))
>
> and things are fine.

Hi Yuning,

thanks for reporting this and debugging it.

I wonder if it also works if the code is changed as seen below?

The difference is, that the end is now a marker which should move
automatically with deletion or insertion ...

Bye,
Robert.


=== modified file 'lisp/vm-rfaddons.el'
--- lisp/vm-rfaddons.el	2008-04-07 18:54:02 +0000
+++ lisp/vm-rfaddons.el	2008-06-05 20:33:21 +0000
@@ -1445,7 +1445,7 @@
 	      (let ((case-fold-search nil))
 		(re-search-forward vm-mime-encode-headers-words-regexp hend t))
             (setq start (match-beginning 1)
-                  end   (match-end 1)
+                  end   (vm-marker (match-end 1))
                   charset (or (vm-determine-proper-charset start end)
                               vm-mime-8bit-composition-charset)
                   coding (vm-string-assoc charset vm-mime-mule-charset-to-coding-alist)
@@ -1455,12 +1455,7 @@
             (insert "?=")
             ;; encode coding system body
             (when (and coding (not (eq coding 'no-conversion)))
-              (goto-char end)
-              ;; this is a bug of encode-coding-region, it does not return
-              ;; the right length of the new text, but always 0
-              (let ((old-buffer-size (buffer-size)))
-                (encode-coding-region start end coding)
-                (setq end (+ end (- (buffer-size) old-buffer-size)))))
+              (encode-coding-region start end coding))
             ;; encode unprintable chars in header
             (vm-mime-Q-encode-region start end)
             ;; insert start mark
Technical Details
Message-ID: <85wsl3d3ag.fsf@robf.de>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!newsfeed.freenet.de!news.space.net!news.m-online.net!not-for-mail
References: <339c95af-a3d1-458b-982b-55405768aa9b@w4g2000prd.googlegroups.com> <b0293111-702a-4f54-845e-5cf59b306089@a32g2000prf.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f6829,2757855d22526eb6
X-Google-Attributes: gidf6829,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!newsfeed.freenet.de!news.space.net!news.m-online.net!not-for-mail
From: newsspam5REMOVETHIS@robf.de
Newsgroups: gnu.emacs.vm.bug
Subject: Re: feature request: B-encoding in headers
Date: Thu, 05 Jun 2008 22:39:51 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 72
Message-ID: <85wsl3d3ag.fsf@robf.de>
References: <339c95af-a3d1-458b-982b-55405768aa9b@w4g2000prd.googlegroups.com> <b0293111-702a-4f54-845e-5cf59b306089@a32g2000prf.googlegroups.com>
NNTP-Posting-Host: ppp-82-135-1-26.dynamic.mnet-online.de
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: svr7.m-online.net 1212698392 21914 82.135.1.26 (5 Jun 2008 20:39:52 GMT)
X-Complaints-To: abuse@m-online.net
NNTP-Posting-Date: Thu, 5 Jun 2008 20:39:52 +0000 (UTC)
User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.21 (linux)
Cancel-Lock: sha1:LTNlEk4FRSeQkUKwtRM+8pThprc=