Assume any characters in the region in the range \200-\237 are compatible with Windows-1252

Download this file here.


;; Make sure we have a unicode transformation function available. 
(if (fboundp 'unicode-to-char)
    (fset 'ucs-to-char 'unicode-to-char)
  (require 'un-define))

(defconst non-standard-1252-char-map 
  (let ((ct (make-char-table 'char)) 
        (ucs-code nil) (mule-char nil) 
        (windows-1252-extra-chars  
         [ #x20AC       ;; EURO SIGN 
           nil          ;; UNDEFINED 
           #x201A       ;; SINGLE LOW-9 QUOTATION MARK 
           #x0192       ;; LATIN SMALL LETTER F WITH HOOK 
           #x201E       ;; DOUBLE LOW-9 QUOTATION MARK 
           #x2026       ;; HORIZONTAL ELLIPSIS 
           #x2020       ;; DAGGER 
           #x2021       ;; DOUBLE DAGGER 
           #x02C6       ;; MODIFIER LETTER CIRCUMFLEX ACCENT 
           #x2030       ;; PER MILLE SIGN 
           #x0160       ;; LATIN CAPITAL LETTER S WITH CARON 
           #x2039       ;; SINGLE LEFT-POINTING ANGLE QUOTATION MARK 
           #x0152       ;; LATIN CAPITAL LIGATURE OE 
           nil          ;; UNDEFINED 
           #x017D       ;; LATIN CAPITAL LETTER Z WITH CARON 
           nil          ;; UNDEFINED 
           nil          ;; UNDEFINED 
           #x2018       ;; LEFT SINGLE QUOTATION MARK 
           #x2019       ;; RIGHT SINGLE QUOTATION MARK 
           #x201C       ;; LEFT DOUBLE QUOTATION MARK 
           #x201D       ;; RIGHT DOUBLE QUOTATION MARK 
           #x2022       ;; BULLET 
           #x2013       ;; EN DASH 
           #x2014       ;; EM DASH 
           #x02DC       ;; SMALL TILDE 
           #x2122       ;; TRADE MARK SIGN 
           #x0161       ;; LATIN SMALL LETTER S WITH CARON 
           #x203A       ;; SINGLE RIGHT-POINTING ANGLE QUOTATION MARK 
           #x0153       ;; LATIN SMALL LIGATURE OE 
           nil          ;; UNDEFINED 
           #x017E       ;; LATIN SMALL LETTER Z WITH CARON 
           #x0178       ;; LATIN CAPITAL LETTER Y WITH DIAERESIS 
              ])) 
    (dotimes (i (length windows-1252-extra-chars)) 
      (setq ucs-code (aref windows-1252-extra-chars i) 
            mule-char (if ucs-code (ucs-to-char ucs-code) nil))
      (if mule-char
          (put-char-table (make-char 'control-1 i) mule-char ct)
        (put-char-table (make-char 'control-1 i) (make-char 'control-1 i) ct)))
    ct)
  "Mapping from the characters in the `control-1' character set to  
the corresponding characters in Windows 1252. ")

(defun non-standard-1252-transform (begin end)
  "Translate the control characters to their Windows-1252 equivalents."
  (save-excursion
    (save-restriction
      (narrow-to-region begin end)
      (goto-char begin)
      (while (not (zerop (setq begin (skip-chars-forward "^\200-\237")
                               end (skip-chars-forward "\200-\237"))))
        (translate-region (point) (- (point) end) 
                          non-standard-1252-char-map)))))

(provide 'non-standard-1252)