charsets

Katsumi Yamaoka yamaoka @ jpl.org
2007年 12月 7日 (金) 20:05:08 JST


>>>>> In [Wanderlust English : No.02240] Dmitri Minaev wrote:
> Hi,

> How  do I define  the charset  for the  messages I  send?  I  have the
> following code  in .wl (partially  borrowed from .gnus  and, probably,
> irrelevant):

> (setq wl-mime-charset 'koi8-r
>       default-mime-charset 'koi8-r
>       wl-folder-mime-charset-alist '(("^-fido7.*" . koi8-r)))
> (put-charset-property 'cyrillic-iso8859-5 'preferred-coding-system 'koi8-r)
> (setq mm-body-charset-encoding-alist '((koi8-r . 8bit)))

`mm-body-charset-encoding-alist' is for Gnus, not for Wanderlust.

> The  messages  sent to  fido7.*  newsgroups  have  the correct  header
> (Content-Type:  text/plain;  charset=koi8-r), but  the  content is  in
> UTF-8.

> Thanks.

> --
> Dmitri Minaev
> Russian history blog: http://minaev.blogspot.com

Could you try this workaround?  To do it, put this Lisp form in
your ~/.emacs file of ~/.wl.el file.

;--8<---------------cut here---------------start------------->8---
(defadvice mime-encode-region (around use-unibyte-buffer
				      (start end encoding) activate)
  "Use unibyte buffer while encoding."
  (let ((string (prog1
		    (buffer-substring start end)
		  (delete-region (goto-char start) end))))
    (insert (with-temp-buffer
	      (set-buffer-multibyte nil)
	      (insert (string-as-unibyte string))
	      (setq start (point-min)
		    end (point-max))
	      ad-do-it
	      (buffer-string)))))
;--8<---------------cut here---------------end--------------->8---

FLIM developers, I found a strange behavior with the Q encoder
defined in mel-q-ccl.el.  `mime-encode-region' seems to run in a
unibyte buffer when encoding a message to send.  If I use Emacs
23.0.60 (i.e. Emacs Unicode-2 that Dmitri uses too), it doesn't
work for "quoted-printable" as follows:

-------------- next part --------------
(with-temp-buffer
  (set-buffer-multibyte t)
  (insert (string-to-multibyte
	   (encode-coding-string "русский" 'koi8-r)))
  (mime-encode-region (point-min) (point-max) "quoted-printable")
  (buffer-string))
 => "\322\325\323\323\313\311\312"
-------------- next part --------------
文字コード指定の無い添付文書を保管しました...
名前: 無し
URL:  <http://lists.chise.org/pipermail/emacs-mime-ja/attachments/20071207/95f288e6/attachment.ksh>


More information about the Emacs-mime-ja mailing list