Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 1 | """ Python Character Mapping Codec generated from '8859-8.TXT' with gencodec.py. |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 2 | |
| 3 | Written by Marc-Andre Lemburg (mal@lemburg.com). |
| 4 | |
| 5 | (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. |
Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 6 | (c) Copyright 2000 Guido van Rossum. |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 7 | |
| 8 | """#" |
| 9 | |
| 10 | import codecs |
| 11 | |
| 12 | ### Codec APIs |
| 13 | |
| 14 | class Codec(codecs.Codec): |
| 15 | |
| 16 | def encode(self,input,errors='strict'): |
| 17 | |
| 18 | return codecs.charmap_encode(input,errors,encoding_map) |
| 19 | |
| 20 | def decode(self,input,errors='strict'): |
| 21 | |
| 22 | return codecs.charmap_decode(input,errors,decoding_map) |
| 23 | |
| 24 | class StreamWriter(Codec,codecs.StreamWriter): |
| 25 | pass |
| 26 | |
| 27 | class StreamReader(Codec,codecs.StreamReader): |
| 28 | pass |
| 29 | |
| 30 | ### encodings module API |
| 31 | |
| 32 | def getregentry(): |
| 33 | |
| 34 | return (Codec().encode,Codec().decode,StreamReader,StreamWriter) |
| 35 | |
| 36 | ### Decoding Map |
| 37 | |
Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 38 | decoding_map = codecs.make_identity_dict(range(256)) |
| 39 | decoding_map.update({ |
| 40 | 0x00a1: None, |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 41 | 0x00aa: 0x00d7, # MULTIPLICATION SIGN |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 42 | 0x00ba: 0x00f7, # DIVISION SIGN |
Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 43 | 0x00bf: None, |
| 44 | 0x00c0: None, |
| 45 | 0x00c1: None, |
| 46 | 0x00c2: None, |
| 47 | 0x00c3: None, |
| 48 | 0x00c4: None, |
| 49 | 0x00c5: None, |
| 50 | 0x00c6: None, |
| 51 | 0x00c7: None, |
| 52 | 0x00c8: None, |
| 53 | 0x00c9: None, |
| 54 | 0x00ca: None, |
| 55 | 0x00cb: None, |
| 56 | 0x00cc: None, |
| 57 | 0x00cd: None, |
| 58 | 0x00ce: None, |
| 59 | 0x00cf: None, |
| 60 | 0x00d0: None, |
| 61 | 0x00d1: None, |
| 62 | 0x00d2: None, |
| 63 | 0x00d3: None, |
| 64 | 0x00d4: None, |
| 65 | 0x00d5: None, |
| 66 | 0x00d6: None, |
| 67 | 0x00d7: None, |
| 68 | 0x00d8: None, |
| 69 | 0x00d9: None, |
| 70 | 0x00da: None, |
| 71 | 0x00db: None, |
| 72 | 0x00dc: None, |
| 73 | 0x00dd: None, |
| 74 | 0x00de: None, |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 75 | 0x00df: 0x2017, # DOUBLE LOW LINE |
| 76 | 0x00e0: 0x05d0, # HEBREW LETTER ALEF |
| 77 | 0x00e1: 0x05d1, # HEBREW LETTER BET |
| 78 | 0x00e2: 0x05d2, # HEBREW LETTER GIMEL |
| 79 | 0x00e3: 0x05d3, # HEBREW LETTER DALET |
| 80 | 0x00e4: 0x05d4, # HEBREW LETTER HE |
| 81 | 0x00e5: 0x05d5, # HEBREW LETTER VAV |
| 82 | 0x00e6: 0x05d6, # HEBREW LETTER ZAYIN |
| 83 | 0x00e7: 0x05d7, # HEBREW LETTER HET |
| 84 | 0x00e8: 0x05d8, # HEBREW LETTER TET |
| 85 | 0x00e9: 0x05d9, # HEBREW LETTER YOD |
| 86 | 0x00ea: 0x05da, # HEBREW LETTER FINAL KAF |
| 87 | 0x00eb: 0x05db, # HEBREW LETTER KAF |
| 88 | 0x00ec: 0x05dc, # HEBREW LETTER LAMED |
| 89 | 0x00ed: 0x05dd, # HEBREW LETTER FINAL MEM |
| 90 | 0x00ee: 0x05de, # HEBREW LETTER MEM |
| 91 | 0x00ef: 0x05df, # HEBREW LETTER FINAL NUN |
| 92 | 0x00f0: 0x05e0, # HEBREW LETTER NUN |
| 93 | 0x00f1: 0x05e1, # HEBREW LETTER SAMEKH |
| 94 | 0x00f2: 0x05e2, # HEBREW LETTER AYIN |
| 95 | 0x00f3: 0x05e3, # HEBREW LETTER FINAL PE |
| 96 | 0x00f4: 0x05e4, # HEBREW LETTER PE |
| 97 | 0x00f5: 0x05e5, # HEBREW LETTER FINAL TSADI |
| 98 | 0x00f6: 0x05e6, # HEBREW LETTER TSADI |
| 99 | 0x00f7: 0x05e7, # HEBREW LETTER QOF |
| 100 | 0x00f8: 0x05e8, # HEBREW LETTER RESH |
| 101 | 0x00f9: 0x05e9, # HEBREW LETTER SHIN |
| 102 | 0x00fa: 0x05ea, # HEBREW LETTER TAV |
Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 103 | 0x00fb: None, |
| 104 | 0x00fc: None, |
| 105 | 0x00fd: 0x200e, # LEFT-TO-RIGHT MARK |
| 106 | 0x00fe: 0x200f, # RIGHT-TO-LEFT MARK |
| 107 | 0x00ff: None, |
| 108 | }) |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 109 | |
| 110 | ### Encoding Map |
| 111 | |
| 112 | encoding_map = {} |
| 113 | for k,v in decoding_map.items(): |
| 114 | encoding_map[v] = k |