Meadow で CP932 (手抜き)

CP932 は基本的には Shift_JIS としてデコードすれば良いのですが、IBM 拡張文字 (115区〜119区)が含まれていると化けてしまいます。これを Meadow でてきとーに 取り扱う方法です。

  1. ari-cp932.el を `load-path' の通ったところに 置く。
  2. ~/.emacs に (require 'ari-cp932) と書く。
  3. japanese-jisx0208 のフォントに Windows フォントを使い、encoder に ari-cp932-font-encoder を指定する。例えば、以下のような感じ。
    (require 'ari-cp932)
    (w32-add-font
     "fixed-14-ari"
     '((spec
    [...]
        ((:char-spec japanese-jisx0208 :height any)
         strict
         (w32-logfont "MS ゴシック" 0 -14 400 0 nil nil nil 128 1 3 49)
         ((encoding . ari-cp932-font-encoder)))
        ((:char-spec japanese-jisx0208 :height any :weight bold)
         strict
         (w32-logfont "MS ゴシック" 0 -14 700 0 nil nil nil 128 1 3 49)
         ((encoding . ari-cp932-font-encoder) (spacing . -1)))
    [...]
        )))
  4. coding-system に ari-cp932 を指定する。例えば、ファイルを開く時には C-x RET c ari-cp932 RET C-x C-f filename RET とするなど。

autodetect

以下のような設定で、autodetect できるかもしれません。

(when (require 'ari-cp932 nil t)
  (define-coding-system-alias 'cp932 'ari-cp932)
  (set-clipboard-coding-system 'ari-cp932-dos)
  ;; for auto-detect
  (setq coding-category-ccl 'ari-cp932)
  (set-coding-priority
   (progn
     (delq 'coding-category-ccl coding-category-list)
     (let ((e (memq 'coding-category-raw-text coding-category-list)))
       (setcar e 'coding-category-ccl)
       (setcdr e (cons 'coding-category-raw-text (cdr e))))
     coding-category-list)))

Valid XHTML 1.1! Valid CSS!
戻る