Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 1 | """ Python Character Mapping Codec generated from '8859-6.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, |
| 41 | 0x00a2: None, |
| 42 | 0x00a3: None, |
| 43 | 0x00a5: None, |
| 44 | 0x00a6: None, |
| 45 | 0x00a7: None, |
| 46 | 0x00a8: None, |
| 47 | 0x00a9: None, |
| 48 | 0x00aa: None, |
| 49 | 0x00ab: None, |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 50 | 0x00ac: 0x060c, # ARABIC COMMA |
Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 51 | 0x00ae: None, |
| 52 | 0x00af: None, |
| 53 | 0x00b0: None, |
| 54 | 0x00b1: None, |
| 55 | 0x00b2: None, |
| 56 | 0x00b3: None, |
| 57 | 0x00b4: None, |
| 58 | 0x00b5: None, |
| 59 | 0x00b6: None, |
| 60 | 0x00b7: None, |
| 61 | 0x00b8: None, |
| 62 | 0x00b9: None, |
| 63 | 0x00ba: None, |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 64 | 0x00bb: 0x061b, # ARABIC SEMICOLON |
Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 65 | 0x00bc: None, |
| 66 | 0x00bd: None, |
| 67 | 0x00be: None, |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 68 | 0x00bf: 0x061f, # ARABIC QUESTION MARK |
Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 69 | 0x00c0: None, |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 70 | 0x00c1: 0x0621, # ARABIC LETTER HAMZA |
| 71 | 0x00c2: 0x0622, # ARABIC LETTER ALEF WITH MADDA ABOVE |
| 72 | 0x00c3: 0x0623, # ARABIC LETTER ALEF WITH HAMZA ABOVE |
| 73 | 0x00c4: 0x0624, # ARABIC LETTER WAW WITH HAMZA ABOVE |
| 74 | 0x00c5: 0x0625, # ARABIC LETTER ALEF WITH HAMZA BELOW |
| 75 | 0x00c6: 0x0626, # ARABIC LETTER YEH WITH HAMZA ABOVE |
| 76 | 0x00c7: 0x0627, # ARABIC LETTER ALEF |
| 77 | 0x00c8: 0x0628, # ARABIC LETTER BEH |
| 78 | 0x00c9: 0x0629, # ARABIC LETTER TEH MARBUTA |
| 79 | 0x00ca: 0x062a, # ARABIC LETTER TEH |
| 80 | 0x00cb: 0x062b, # ARABIC LETTER THEH |
| 81 | 0x00cc: 0x062c, # ARABIC LETTER JEEM |
| 82 | 0x00cd: 0x062d, # ARABIC LETTER HAH |
| 83 | 0x00ce: 0x062e, # ARABIC LETTER KHAH |
| 84 | 0x00cf: 0x062f, # ARABIC LETTER DAL |
| 85 | 0x00d0: 0x0630, # ARABIC LETTER THAL |
| 86 | 0x00d1: 0x0631, # ARABIC LETTER REH |
| 87 | 0x00d2: 0x0632, # ARABIC LETTER ZAIN |
| 88 | 0x00d3: 0x0633, # ARABIC LETTER SEEN |
| 89 | 0x00d4: 0x0634, # ARABIC LETTER SHEEN |
| 90 | 0x00d5: 0x0635, # ARABIC LETTER SAD |
| 91 | 0x00d6: 0x0636, # ARABIC LETTER DAD |
| 92 | 0x00d7: 0x0637, # ARABIC LETTER TAH |
| 93 | 0x00d8: 0x0638, # ARABIC LETTER ZAH |
| 94 | 0x00d9: 0x0639, # ARABIC LETTER AIN |
| 95 | 0x00da: 0x063a, # ARABIC LETTER GHAIN |
Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 96 | 0x00db: None, |
| 97 | 0x00dc: None, |
| 98 | 0x00dd: None, |
| 99 | 0x00de: None, |
| 100 | 0x00df: None, |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 101 | 0x00e0: 0x0640, # ARABIC TATWEEL |
| 102 | 0x00e1: 0x0641, # ARABIC LETTER FEH |
| 103 | 0x00e2: 0x0642, # ARABIC LETTER QAF |
| 104 | 0x00e3: 0x0643, # ARABIC LETTER KAF |
| 105 | 0x00e4: 0x0644, # ARABIC LETTER LAM |
| 106 | 0x00e5: 0x0645, # ARABIC LETTER MEEM |
| 107 | 0x00e6: 0x0646, # ARABIC LETTER NOON |
| 108 | 0x00e7: 0x0647, # ARABIC LETTER HEH |
| 109 | 0x00e8: 0x0648, # ARABIC LETTER WAW |
| 110 | 0x00e9: 0x0649, # ARABIC LETTER ALEF MAKSURA |
| 111 | 0x00ea: 0x064a, # ARABIC LETTER YEH |
| 112 | 0x00eb: 0x064b, # ARABIC FATHATAN |
| 113 | 0x00ec: 0x064c, # ARABIC DAMMATAN |
| 114 | 0x00ed: 0x064d, # ARABIC KASRATAN |
| 115 | 0x00ee: 0x064e, # ARABIC FATHA |
| 116 | 0x00ef: 0x064f, # ARABIC DAMMA |
| 117 | 0x00f0: 0x0650, # ARABIC KASRA |
| 118 | 0x00f1: 0x0651, # ARABIC SHADDA |
| 119 | 0x00f2: 0x0652, # ARABIC SUKUN |
Marc-André Lemburg | a866df8 | 2001-01-03 21:29:14 +0000 | [diff] [blame] | 120 | 0x00f3: None, |
| 121 | 0x00f4: None, |
| 122 | 0x00f5: None, |
| 123 | 0x00f6: None, |
| 124 | 0x00f7: None, |
| 125 | 0x00f8: None, |
| 126 | 0x00f9: None, |
| 127 | 0x00fa: None, |
| 128 | 0x00fb: None, |
| 129 | 0x00fc: None, |
| 130 | 0x00fd: None, |
| 131 | 0x00fe: None, |
| 132 | 0x00ff: None, |
| 133 | }) |
Guido van Rossum | 0229bf6 | 2000-03-10 23:17:24 +0000 | [diff] [blame] | 134 | |
| 135 | ### Encoding Map |
| 136 | |
| 137 | encoding_map = {} |
| 138 | for k,v in decoding_map.items(): |
| 139 | encoding_map[v] = k |