← Back to team overview

vm team mailing list archive

[Bug 205554] Re: vm-mime-encode-headers broken

 

** Project changed: viewmail => vm

-- 
vm-mime-encode-headers broken
https://bugs.launchpad.net/bugs/205554
You received this bug notification because you are a member of VM
development team, which is the registrant for VM (defunct).

Status in VM (View Mail) for Emacs: Fix Released

Bug description:
vm-mime-encode-headers does not work correctly if characters to be encoded are near
the end of the header line; the last ones of these are sent as "~".
An example header showing this problem:

Subject: ≙≙≙

My environment:
Ubuntu Hardy Heron Beta,
XEmacs-21.5.28 built from source from Mercurial as of 2008-03-22,
VM-8.0.9-544.

The reason this happens is that vm-mime-encode-headers saves the end of the region to 
encode in a marker instead of simply using a buffer position (I don't know why this is done).
The call to encode-coding-region as a side effect moves the marker to the beginning of
the encoded region, messing up the calculation of the region with which
vm-mime-Q-encode-region is called.

To see the effect, put the following in *scratch*:

(let* ((start (point-min))
       (end (set-marker (make-marker)
                        (save-excursion
                          (beginning-of-buffer)
                          (end-of-line)
                          (point))))
       (end2 (marker-position end)))
  (encode-coding-region start end 'utf-8)
  (list (marker-position end) end2))

and evaluate it. I get:
(1 27)

Suggested fix: Don't use a marker here, see the attached patch.
Alternatively, use set-marker-insertion-type to make the marker
move after the encoded region. I don't know how portable that is
over the various emacsen/their versions.

Kind regards

Lutz Euler