dired で複数のファイルの文字コードを一括変換
http://www.bookshelf.jp/soft/meadow_25.html#SEC273
;;; dired を使って、一気にファイルの coding system (漢字) を変換する ;; m でマークして T で一括変換 (require 'dired-aux) (add-hook 'dired-mode-hook (lambda () (define-key (current-local-map) "T" 'dired-do-convert-coding-system))) (defvar dired-default-file-coding-system nil "*Default coding system for converting file (s).") (defvar dired-file-coding-system 'no-conversion) (defun dired-convert-coding-system () (let ((file (dired-get-filename)) (coding-system-for-write dired-file-coding-system) failure) (condition-case err (with-temp-buffer (insert-file file) (write-region (point-min) (point-max) file)) (error (setq failure err))) (if (not failure) nil (dired-log "convert coding system error for %s:\n%s\n" file failure) (dired-make-relative file)))) (defun dired-do-convert-coding-system (coding-system &optional arg) "Convert file (s) in specified coding system." (interactive (list (let ((default (or dired-default-file-coding-system buffer-file-coding-system))) (read-coding-system (format "Coding system for converting file (s) (default, %s): " default) default)) current-prefix-arg)) (check-coding-system coding-system) (setq dired-file-coding-system coding-system) (dired-map-over-marks-check (function dired-convert-coding-system) arg 'convert-coding-system t))
追記
設定書いてからずっと使ってなかったけど、これすごい便利。
ファイルごとに「C-x RET r utf-8」をしたりするのってけっこう手間なので
一括で変換できると助かる!