Wanderlustで日本語名の添付ファイルを読み書きできるようにする。
http://kakutani.com/20040422.html
;;日本語の添付ファイル名を正しく表示;;これがないと化けます.
(defvar my-mime-filename-coding-system-for-decode '(iso-2022-jp japanese-shift-jis japanese-iso-8bit)) (defun my-mime-decode-filename (filename) (let ((rest (eword-decode-string filename))) (or (when (and my-mime-filename-coding-system-for-decode (string= rest filename)) (let ((dcs (mapcar (function coding-system-base) (detect-coding-string filename)))) (unless (memq 'emacs-mule dcs) (let ((pcs my-mime-filename-coding-system-for-decode)) (while pcs (if (memq (coding-system-base (car pcs)) dcs) (setq rest (decode-coding-string filename (car pcs)) pcs nil) (setq pcs (cdr pcs)))))))) rest))) (eval-after-load "mime" '(defadvice mime-entity-filename (after eword-decode-for-broken-MUA activate) "Decode encoded file name for BROKEN MUA." (when (stringp ad-return-value) (setq ad-return-value (my-mime-decode-filename ad-return-value))))) (require 'std11) ;; ファイル名が日本語の添付ファイルをエンコードする [semi-gnus-ja: 6046] (eval-after-load "std11" '(defadvice std11-wrap-as-quoted-string (before encode-string activate) "Encode a string." (require 'eword-encode) (ad-set-arg 0 (eword-encode-string (ad-get-arg 0)))))