Function: recode-region

recode-region is an interactive and byte-compiled function defined in mule.el.gz.

Signature

(recode-region START END NEW-CODING CODING)

Documentation

Re-decode the region (previously decoded by CODING) by NEW-CODING.

View in manual

Probably introduced at or before Emacs version 22.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule.el.gz
(defun recode-region (start end new-coding coding)
  "Re-decode the region (previously decoded by CODING) by NEW-CODING."
  (interactive
   (list (region-beginning) (region-end)
	 (read-coding-system "Text was really in: ")
	 (let ((coding (or buffer-file-coding-system last-coding-system-used)))
	   (read-coding-system
	    (format-prompt "But was interpreted as" coding)
	    coding))))
  (or (and new-coding coding)
      (error "Coding system not specified"))
  ;; Check it before we encode the region.
  (check-coding-system new-coding)
  (save-restriction
    (narrow-to-region start end)
    (encode-coding-region (point-min) (point-max) coding)
    (decode-coding-region (point-min) (point-max) new-coding))
  (if (region-active-p)
      (deactivate-mark)))