Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

feature request: B-encoding in headers

0 views
Skip to first unread message

Yuning Feng

unread,
May 22, 2008, 2:51:10 AM5/22/08
to
If I understand the code correctly, the current code implements header
encoding in vm-rfaddons.el:vm-mime-encode-headers, and Q-encoding is
the only encoding method. It would be better if B-encoding is
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.

Yuning Feng

unread,
May 23, 2008, 3:47:14 AM5/23/08
to
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.

newsspam5...@robf.de

unread,
Jun 5, 2008, 4:39:51 PM6/5/08
to

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

0 new messages