]> git.eshelyaron.com Git - emacs.git/commitdiff
(cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
authorEli Zaretskii <eliz@gnu.org>
Mon, 8 Mar 1999 12:06:07 +0000 (12:06 +0000)
committerEli Zaretskii <eliz@gnu.org>
Mon, 8 Mar 1999 12:06:07 +0000 (12:06 +0000)
cp1257-decode-table): New translation tables for MS Windows
codepages.
(cp-make-coding-systems-for-codepage): Accept 4 digit
codepages.

lisp/international/codepage.el

index 6f595c61b9011d4d8207a2de12291e7379a8075b..b71bfdc65bbc90157c783b98abc9d9729b2f2423 100644 (file)
@@ -416,6 +416,78 @@ character is generated by (make-char CHARSET OFFSET)."
 (setplist 'cp775-decode-table
          '(charset latin-iso8859-4 language "Latin-4" offset 160))
 
+;; Support for the Windows 12xx series of codepages that MS has
+;; butchered from the ISO-8859 specs. This does not add support for
+;; the extended characters that MS has added in the 128 - 159 coding
+;; range, only translates those characters that can be expressed in
+;; the corresponding iso-8859 codepage.
+
+;; Codepage Mapping:
+;;
+;; Windows-1250: ISO-8859-2 (Central Europe) - differs in some positions
+;; Windows-1251: ISO-8859-5 (Cyrillic)       - differs wildly
+;; Windows-1252: ISO-8859-1 (West Europe)    - exact match
+;; Windows-1253: ISO-8859-7 (Greek)          - differs in some positions
+;; Windows-1254: ISO-8859-9 (Turkish)        - exact match
+;; Windows-1255: ISO-8859-8 (Hebrew)         - exact match
+;; Windows-1256: ISO-8859-6 (Arabic)         - half match
+;; Windows-1257: ISO-8859-4 (Baltic)         - differs, future Latin-7
+;; Windows-1258: VISCII (Vietnamese)         - Completely different
+
+(defvar cp1250-decode-table
+  [
+    160 165 162 163 164 188 140 167 168 138 170 141 143 173 142 175
+    176 185 178 179 180 190 156 161 184 154 186 157 159 189 158 191
+    192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
+    208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
+    224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
+    240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 ]
+  "ISO-8859-2 to Windows-1250 (Central Europe) codepage decoding table")
+(setplist 'cp1250-decode-table
+          '(charset latin-iso8859-2 language "Latin-2" offset 160))
+
+(defvar cp1251-decode-table
+  [
+    160 168 128 129 170 189 178 175 163 138 140 142 141 173 161 143
+    192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
+    208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
+    224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
+    240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
+    185 184 144 131 186 190 179 191 188 154 156 158 157 167 162 159 ]
+  "ISO-8859-5 to Windows-1251 (Cyrillic) codepage decoding table")
+(setplist 'cp1251-decode-table
+          '(charset cyrillic-iso8859-5 language "Cyrillic-ISO" offset 160))
+
+;; cp1253 is missing nbsp so we cannot quite translate perfectly. It
+;; also has two micro/mu characters which would require more complex
+;; processing to accomodate.
+(defvar cp1253-decode-table
+  [
+    nil 145 146 163 nil nil 166 167 168 169 nil 171 172 173 nil 151
+    176 177 178 179 180 161 162 183 184 185 186 187 188 189 190 191
+    192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
+    208 209 nil 211 212 213 214 215 216 217 218 219 220 221 222 223
+    224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
+    240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 nil ]
+  "ISO-8859-7 to Windows-1253 (Greek) codepage decoding table")
+(setplist 'cp1253-decode-table
+          '(charset greek-iso8859-7 language "Greek" offset 160))
+
+;; Since Latin-7 is not yet official, and Emacs does not support it,
+;; provide translation between Windows-1257 and Latin-4 the best we
+;; can.
+(defvar cp1257-decode-table
+  [
+    160 192 nil 170 164 nil 207 167 nil 208 199 204 nil 173 222 nil
+    176 224 nil 186 nil nil 239 nil nil 240 231 236 nil nil 254 nil
+    194 nil nil nil 196 197 175 193 200 201 198 nil 203 nil nil 206
+    nil 210 212 205 nil 213 214 215 168 216 nil nil 220 nil 219 223
+    226 nil nil nil 228 229 191 225 232 233 230 nil 235 nil nil 238
+    nil 242 244 237 nil 245 246 247 184 248 nil nil 252 nil 251 nil ]
+  "ISO-8859-4 to Windows-1257 (Baltic) codepage decoding table")
+(setplist 'cp1257-decode-table
+          '(charset latin-iso8859-4 language "Latin-4" offset 160))
+
 ;;;###autoload
 (defun cp-make-coding-systems-for-codepage (codepage iso-name offset)
   "Create a coding system to convert IBM CODEPAGE into charset ISO-NAME
@@ -514,7 +586,7 @@ is a vector, and has a charset property."
        (function
        (lambda (sym)
          (if (and (boundp sym)
-                  (string-match "\\`cp\\([1-9][0-9][0-9]\\)-decode-table\\'"
+                  (string-match "\\`cp\\([1-9][0-9][0-9][0-9]?\\)-decode-table\\'"
                                 (setq sname (symbol-name sym)))
                   (vectorp (symbol-value sym))
                   (setq chset (get sym 'charset)))