;;; iso-pc.el --- Work with Texts in ISO-8859-1 charset on an IBM-PC ;;; using Codepage 850 ;; Author: Carsten Leonhardt ;; Version 0.4 - November 18, 1995, 15:00 CET ;; Copyright (c) 1995 Carsten Leonhardt ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free ;; Software Foundation; either version 2, or (at your option) any later ;; version. ;; This code is distributed in the hope that it will be useful, but WITHOUT ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ;; for more details. ;; You should have received a copy of the GNU General Public License along ;; with GNU Emacs; see the file COPYING. If not, write to the Free ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; ;;; Commentary: ;; ;; This code sets Emacs up to work on texts using ISO-8859-1 (Latin-1) ;; characters on IBM-PCs using the Codepage 850 ;; ;; If you load this file, characters will still be displayed as CP-850 chars, ;; to display them as ISO-8859-1 chars, you have to call 'iso-pc-enable' or ;; 'iso-pc'. ;; ;; There are three functions you can call: ;; ;; 'iso-pc' ;; ;; Used to toggle between ISO-8859-1 mode and CP-850 mode. ;; Very handy if bound to a key. ;; ;; 'iso-pc-enable' ;; ;; Enables the ISO-8859-1 mode ;; ;; 'iso-pc-disable' ;; ;; Disables the ISO-8859-1 mode and leaves you with your CP-850 characters ;;; ;;; Limitations: ;; ;; When using Gnus 5.0, changing the display tables doesn't affect the ;; display in the Summary Buffer. So you should enable the ISO-8859-1 ;; before entering the Summary Buffer if you want it to be displayed as ;; ISO-8859-1 text. ;; ;; If you enter a character from the keyboard which does not exist in ;; ISO-8859-1 (these are those stupid box drawings signs, the 'dutch ;; guilder sign', the dotless i and the greek mu), you'll get a space ;; instead. ;; ;; If ISO-8859-1 characters are displayed, the control characters from 128 ;; to 159 are displayed as an abbreviation of the name of the character in ;; curly brackets (like '{SS2}'). ;;; ;;; To install: ;; ;; First put this file somewhere into your loadpath. ;; ;; To enable the switching, put the following line into your ~/.emacs: ;; ;; (load "iso-pc") ;; ;; You should ensure that _all_ characters are displayed (the default will ;; not display character 255, which is a y with diaresis in the CP-850 ;; charset) by also adding the following line to your ~/.emacs ;; ;; (standard-display-8bit 128 255) ;; ;; You might want Emacs to know the lowercase-uppercase relation of the ;; newly aquired characters by adding the following to your ~/.emacs ;; ;; (require 'iso-syntax) ;; ;; I find it convenient to be able to switch between the two display-modes ;; with a simple key-combination (C-^ is pretty quick on my german keyboard) ;; ;; (global-set-key "" 'iso-pc) ;;; Code: (require 'disp-table) (defvar iso-pc-enabled nil "This variable is used to determine the state in which iso-pc currently is. t means translation is enabled, nil means translation is disabled. See function iso-pc for a little more information") (defun iso-pc-enable-keyboard () "Enable translation from keyboard to ISO-8859-1" (let ((the-table (make-string 256 0))) (let ((i 0)) (while (< i 256) (aset the-table i i) (setq i (1+ i)))) ;;; Insert ISO-8859-1 codes instead of CP850 codes ;;; ;;; Are the capital letters with grave correct ? ;;; ;;; if you see the described characters, you look at this file with ISO-8859-1 (aset the-table ?\200 ?\) ;; C with cedilla (aset the-table ?\201 ?\) ;; u with diaresis (aset the-table ?\202 ?\) ;; e with acute (aset the-table ?\203 ?\) ;; a with circumflex (aset the-table ?\204 ?\) ;; a with diaresis (aset the-table ?\205 ?\) ;; a with grave (aset the-table ?\206 ?\) ;; a with ring (aset the-table ?\207 ?\) ;; c with cedilla (aset the-table ?\210 ?\) ;; e with circumflex (aset the-table ?\211 ?\) ;; e with diaresis (aset the-table ?\212 ?\) ;; e with grave (aset the-table ?\213 ?\) ;; i with diaresis (aset the-table ?\214 ?\) ;; i with circumflex (aset the-table ?\215 ?\) ;; i with grave (aset the-table ?\216 ?\) ;; A with diaresis (aset the-table ?\217 ?\) ;; A with ring (aset the-table ?\220 ?\) ;; E with acute (aset the-table ?\221 ?\) ;; ae (aset the-table ?\222 ?\) ;; AE (aset the-table ?\223 ?\) ;; o with circumflex (aset the-table ?\224 ?\) ;; o with diaresis (aset the-table ?\225 ?\) ;; o with grave (aset the-table ?\226 ?\) ;; u with circumflex (aset the-table ?\227 ?\) ;; u with grave (aset the-table ?\230 ?\) ;; y with diaresis (aset the-table ?\231 ?\) ;; O with diaresis (aset the-table ?\232 ?\) ;; U with diaresis (aset the-table ?\233 ?\) ;; o with stroke (aset the-table ?\234 ?\) ;; pound sign (aset the-table ?\235 ?\) ;; O with stroke (aset the-table ?\236 ?\) ;; multiplication sign (aset the-table ?\237 ?\ ) ;; dutch guilder sign (no iso-equivalent) (aset the-table ?\240 ?\) ;; a with acute (aset the-table ?\241 ?\) ;; i with acute (aset the-table ?\242 ?\) ;; o with acute (aset the-table ?\243 ?\) ;; u with acute (aset the-table ?\244 ?\) ;; n with tilde (aset the-table ?\245 ?\) ;; N with tilde (aset the-table ?\246 ?\) ;; feminine ordinal indicator (aset the-table ?\247 ?\) ;; masculine ordinal indicator (aset the-table ?\250 ?\) ;; inverted question mark (aset the-table ?\251 ?\) ;; registered sign (aset the-table ?\252 ?\) ;; not sign (aset the-table ?\253 ?\) ;; vulgar fraction one half (aset the-table ?\254 ?\) ;; vulgar fraction one quarter (aset the-table ?\255 ?\) ;; inverted exclamation mark (aset the-table ?\256 ?\) ;; << (aset the-table ?\257 ?\) ;; >> (aset the-table ?\260 ?\ ) ;; light shade (non-iso) (aset the-table ?\261 ?\ ) ;; medium shade (non-iso) (aset the-table ?\262 ?\ ) ;; dark shade (non-iso) (aset the-table ?\263 ?\ ) ;; box drawings light vertical (non-iso) (aset the-table ?\264 ?\ ) ;; box drawings light vertical and left (non-iso) (aset the-table ?\265 ?\) ;; A with acute (aset the-table ?\266 ?\) ;; A with circumflex (aset the-table ?\267 ?\) ;; A with grave (aset the-table ?\270 ?\) ;; copyright sign (aset the-table ?\271 ?\ ) ;; (non-iso) (aset the-table ?\272 ?\ ) ;; (non-iso) (aset the-table ?\273 ?\ ) ;; (non-iso) (aset the-table ?\274 ?\ ) ;; (non-iso) (aset the-table ?\275 ?\) ;; cent sign (aset the-table ?\276 ?\) ;; yen sign (aset the-table ?\277 ?\ ) ;; (non-iso) (aset the-table ?\300 ?\ ) ;; (non-iso) (aset the-table ?\301 ?\ ) ;; (non-iso) (aset the-table ?\302 ?\ ) ;; (non-iso) (aset the-table ?\303 ?\ ) ;; (non-iso) (aset the-table ?\304 ?\ ) ;; (non-iso) (aset the-table ?\305 ?\ ) ;; (non-iso) (aset the-table ?\306 ?\) ;; a with tilde (aset the-table ?\307 ?\) ;; A with tilde (aset the-table ?\310 ?\ ) ;; (non-iso) (aset the-table ?\311 ?\ ) ;; (non-iso) (aset the-table ?\312 ?\ ) ;; (non-iso) (aset the-table ?\313 ?\ ) ;; (non-iso) (aset the-table ?\314 ?\ ) ;; (non-iso) (aset the-table ?\315 ?\ ) ;; (non-iso) (aset the-table ?\316 ?\ ) ;; (non-iso) (aset the-table ?\317 ?\) ;; currency sign (aset the-table ?\320 ?\) ;; eth (icelandic) (aset the-table ?\321 ?\) ;; ETH (icelandic) (aset the-table ?\322 ?\) ;; E with circumflex (aset the-table ?\323 ?\) ;; E with diaresis (aset the-table ?\324 ?\) ;; E with grave (aset the-table ?\325 ?\ ) ;; i dotless (non-iso) (aset the-table ?\326 ?\) ;; I with acute (aset the-table ?\327 ?\) ;; I with circumflex (aset the-table ?\330 ?\) ;; I with diaresis (aset the-table ?\331 ?\ ) ;; (non-iso) (aset the-table ?\332 ?\ ) ;; (non-iso) (aset the-table ?\333 ?\ ) ;; (non-iso) (aset the-table ?\334 ?\ ) ;; (non-iso) (aset the-table ?\335 ?\) ;; broken bar (aset the-table ?\336 ?\) ;; I with grave (aset the-table ?\337 ?\ ) ;; (non-iso) (aset the-table ?\340 ?\) ;; O with acute (aset the-table ?\341 ?\) ;; sharp s (aset the-table ?\342 ?\) ;; O with circumflex (aset the-table ?\343 ?\) ;; O with grave (aset the-table ?\344 ?\) ;; o with tilde (aset the-table ?\345 ?\) ;; O with tilde (aset the-table ?\346 ?\ ) ;; mu (greek) (non-iso) (aset the-table ?\347 ?\) ;; THORN (icelandic) (aset the-table ?\350 ?\) ;; thorn (icelandic) (aset the-table ?\351 ?\) ;; U with acute (aset the-table ?\352 ?\) ;; U with circumflex (aset the-table ?\353 ?\) ;; U with grave (aset the-table ?\354 ?\) ;; y with acute (aset the-table ?\355 ?\) ;; Y with acute (aset the-table ?\356 ?\ ) ;; em dash (non-iso) (aset the-table ?\357 ?\) ;; acute accent (aset the-table ?\360 ?\) ;; soft hyphen (aset the-table ?\361 ?\) ;; plus-minus sign (aset the-table ?\362 ?\ ) ;; (non-iso) (aset the-table ?\363 ?\) ;; vulgar fraction three quarters (aset the-table ?\364 ?\) ;; pilcrow sign (aset the-table ?\365 ?\) ;; section sign (aset the-table ?\366 ?\) ;; division sign (aset the-table ?\367 ?\ ) ;; ogonek (non-iso) (aset the-table ?\370 ?\) ;; degree sign (aset the-table ?\371 ?\) ;; diaresis (aset the-table ?\372 ?\ ) ;; dot above (non-iso) (aset the-table ?\373 ?\) ;; superscript one (aset the-table ?\374 ?\) ;; superscript three (aset the-table ?\375 ?\) ;; superscript two (aset the-table ?\376 ?\ ) ;; (non-iso) (aset the-table ?\377 ?\) ;; no-break space (setq keyboard-translate-table the-table))) (defun iso-pc-enable-display () "Enable translation from ISO-8859-1 to display" ;;; if you see the described signs, you are looking at this file with CP850 (standard-display-ascii 128 "{PAD}") ; (standard-display-ascii 129 "{HOP}") ; (standard-display-ascii 130 "{BPH}") ; (standard-display-ascii 131 "{NBH}") ; (standard-display-ascii 132 "{IND}") ; (standard-display-ascii 133 "{NEL}") ; (standard-display-ascii 134 "{SSA}") ; (standard-display-ascii 135 "{ESA}") ; (standard-display-ascii 136 "{HTS}") ; (standard-display-ascii 137 "{HTJ}") ; (standard-display-ascii 138 "{VTS}") ; (standard-display-ascii 139 "{PLD}") ; (standard-display-ascii 140 "{PLU}") ; (standard-display-ascii 141 "{RI}") ; (standard-display-ascii 142 "{SS2}") ; (standard-display-ascii 143 "{SS3}") ; (standard-display-ascii 144 "{DCS}") ; (standard-display-ascii 145 "{PU1}") ; (standard-display-ascii 146 "{PU2}") ; (standard-display-ascii 147 "{STS}") ; (standard-display-ascii 148 "{CCH}") ; (standard-display-ascii 149 "{MW}") ; (standard-display-ascii 150 "{SPA}") ; (standard-display-ascii 151 "{EPA}") ; (standard-display-ascii 152 "{SOS}") ; (standard-display-ascii 153 "{SGCI}") ; (standard-display-ascii 154 "{SCI}") ; (standard-display-ascii 155 "{CSI}") ; (standard-display-ascii 156 "{ST}") ; (standard-display-ascii 157 "{OSC}") ; (standard-display-ascii 158 "{PM}") ; (standard-display-ascii 159 "{APC}") ; (standard-display-ascii 160 "") ; NBSP (no-break space) (standard-display-ascii 161 "") ; inverted exclamation mark (standard-display-ascii 162 "") ; cent sign (standard-display-ascii 163 "") ; pound sign (standard-display-ascii 164 "") ; general currency sign (standard-display-ascii 165 "") ; yen sign (standard-display-ascii 166 "") ; broken vertical line (standard-display-ascii 167 "") ; section sign (standard-display-ascii 168 "") ; diaeresis (standard-display-ascii 169 "") ; copyright sign (standard-display-ascii 170 "") ; ordinal indicator, feminine (standard-display-ascii 171 "") ; left angle quotation mark (standard-display-ascii 172 "") ; not sign (standard-display-ascii 173 "") ; soft hyphen (standard-display-ascii 174 "") ; registered sign (standard-display-ascii 175 "{=}") ; macron (standard-display-ascii 176 "") ; degree sign (standard-display-ascii 177 "") ; plus or minus sign (standard-display-ascii 178 "") ; superscript two (standard-display-ascii 179 "") ; superscript three (standard-display-ascii 180 "") ; acute accent (standard-display-ascii 181 "{u}") ; micro sign (standard-display-ascii 182 "") ; pilcrow (standard-display-ascii 183 "{.}") ; middle dot (standard-display-ascii 184 "{,}") ; cedilla (standard-display-ascii 185 "") ; superscript one (standard-display-ascii 186 "") ; ordinal indicator, masculine (standard-display-ascii 187 "") ; right angle quotation mark (standard-display-ascii 188 "") ; fraction one-quarter (standard-display-ascii 189 "") ; fraction one-half (standard-display-ascii 190 "") ; fraction three-quarters (standard-display-ascii 191 "") ; inverted question mark (standard-display-ascii 192 "") ; A with grave accent (standard-display-ascii 193 "") ; A with acute accent (standard-display-ascii 194 "") ; A with circumflex accent (standard-display-ascii 195 "") ; A with tilde (standard-display-ascii 196 "") ; A with diaeresis or umlaut mark (standard-display-ascii 197 "") ; A with ring (standard-display-ascii 198 "") ; AE diphthong (standard-display-ascii 199 "") ; C with cedilla (standard-display-ascii 200 "") ; E with grave accent (standard-display-ascii 201 "") ; E with acute accent (standard-display-ascii 202 "") ; E with circumflex accent (standard-display-ascii 203 "") ; E with diaeresis or umlaut mark (standard-display-ascii 204 "") ; I with grave accent (standard-display-ascii 205 "") ; I with acute accent (standard-display-ascii 206 "") ; I with circumflex accent (standard-display-ascii 207 "") ; I with diaeresis or umlaut mark (standard-display-ascii 208 "") ; D with stroke, Icelandic eth (standard-display-ascii 209 "") ; N with tilde (standard-display-ascii 210 "") ; O with grave accent (standard-display-ascii 211 "") ; O with acute accent (standard-display-ascii 212 "") ; O with circumflex accent (standard-display-ascii 213 "") ; O with tilde (standard-display-ascii 214 "") ; O with diaeresis or umlaut mark (standard-display-ascii 215 "") ; multiplication sign (standard-display-ascii 216 "") ; O with slash (standard-display-ascii 217 "") ; U with grave accent (standard-display-ascii 218 "") ; U with acute accent (standard-display-ascii 219 "") ; U with circumflex accent (standard-display-ascii 220 "") ; U with diaeresis or umlaut mark (standard-display-ascii 221 "") ; Y with acute accent (standard-display-ascii 222 "") ; capital thorn, Icelandic (standard-display-ascii 223 "") ; small sharp s, German (standard-display-ascii 224 "") ; a with grave accent (standard-display-ascii 225 "") ; a with acute accent (standard-display-ascii 226 "") ; a with circumflex accent (standard-display-ascii 227 "") ; a with tilde (standard-display-ascii 228 "") ; a with diaeresis or umlaut mark (standard-display-ascii 229 "") ; a with ring (standard-display-ascii 230 "") ; ae diphthong (standard-display-ascii 231 "") ; c with cedilla (standard-display-ascii 232 "") ; e with grave accent (standard-display-ascii 233 "") ; e with acute accent (standard-display-ascii 234 "") ; e with circumflex accent (standard-display-ascii 235 "") ; e with diaeresis or umlaut mark (standard-display-ascii 236 "") ; i with grave accent (standard-display-ascii 237 "") ; i with acute accent (standard-display-ascii 238 "") ; i with circumflex accent (standard-display-ascii 239 "") ; i with diaeresis or umlaut mark (standard-display-ascii 240 "") ; d with stroke, Icelandic eth (standard-display-ascii 241 "") ; n with tilde (standard-display-ascii 242 "") ; o with grave accent (standard-display-ascii 243 "") ; o with acute accent (standard-display-ascii 244 "") ; o with circumflex accent (standard-display-ascii 245 "") ; o with tilde (standard-display-ascii 246 "") ; o with diaeresis or umlaut mark (standard-display-ascii 247 "") ; division sign (standard-display-ascii 248 "") ; o with slash (standard-display-ascii 249 "") ; u with grave accent (standard-display-ascii 250 "") ; u with acute accent (standard-display-ascii 251 "") ; u with circumflex accent (standard-display-ascii 252 "") ; u with diaeresis or umlaut mark (standard-display-ascii 253 "") ; y with acute accent (standard-display-ascii 254 "") ; small thorn, Icelandic (standard-display-ascii 255 "") ; small y with diaeresis or umlaut mark ) (defun iso-pc-disable () "Disable all translation, display and accept characters in native way. If called non-interactively, a 'redraw-display' may be necessary" (interactive) (setq keyboard-translate-table nil) (standard-display-8bit 128 255) (setq iso-pc-enabled nil) (message "Now CP850 characters are displayed and accepted")) (defun iso-pc-enable () "Enable Translation of display and keyboard to behave as if working with ISO-8859-1. If called non-interactively, a 'redraw-display' may be necessary" (interactive) (iso-pc-enable-display) (iso-pc-enable-keyboard) (setq iso-pc-enabled t) (message "Now ISO-8859-1 characters are displayed and accepted")) (defun iso-pc () "Work with Texts in ISO-8859-1 charset on an IBM-PC using Codepage 850. This function toggles between conversion and normal, according to the value of iso-pc-enabled" (interactive) (if iso-pc-enabled (iso-pc-disable) (iso-pc-enable) ) (redraw-display)) ;;; I don't think this is really needed... (provide 'iso-pc) ;;; iso-pc.el ends here