1""" Python Character Mapping Codec generated from 'PTCP154.txt' with gencodec.py. 2 3Written by Marc-Andre Lemburg (mal@lemburg.com). 4 5(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. 6(c) Copyright 2000 Guido van Rossum. 7 8"""#" 9 10import codecs 11 12### Codec APIs 13 14class Codec(codecs.Codec): 15 16 def encode(self,input,errors='strict'): 17 return codecs.charmap_encode(input,errors,encoding_table) 18 19 def decode(self,input,errors='strict'): 20 return codecs.charmap_decode(input,errors,decoding_table) 21 22class IncrementalEncoder(codecs.IncrementalEncoder): 23 def encode(self, input, final=False): 24 return codecs.charmap_encode(input,self.errors,encoding_table)[0] 25 26class IncrementalDecoder(codecs.IncrementalDecoder): 27 def decode(self, input, final=False): 28 return codecs.charmap_decode(input,self.errors,decoding_table)[0] 29 30class StreamWriter(Codec,codecs.StreamWriter): 31 pass 32 33class StreamReader(Codec,codecs.StreamReader): 34 pass 35 36### encodings module API 37 38def getregentry(): 39 return codecs.CodecInfo( 40 name='ptcp154', 41 encode=Codec().encode, 42 decode=Codec().decode, 43 incrementalencoder=IncrementalEncoder, 44 incrementaldecoder=IncrementalDecoder, 45 streamreader=StreamReader, 46 streamwriter=StreamWriter, 47 ) 48 49 50### Decoding Table 51 52decoding_table = ( 53 '\x00' # 0x00 -> NULL 54 '\x01' # 0x01 -> START OF HEADING 55 '\x02' # 0x02 -> START OF TEXT 56 '\x03' # 0x03 -> END OF TEXT 57 '\x04' # 0x04 -> END OF TRANSMISSION 58 '\x05' # 0x05 -> ENQUIRY 59 '\x06' # 0x06 -> ACKNOWLEDGE 60 '\x07' # 0x07 -> BELL 61 '\x08' # 0x08 -> BACKSPACE 62 '\t' # 0x09 -> HORIZONTAL TABULATION 63 '\n' # 0x0A -> LINE FEED 64 '\x0b' # 0x0B -> VERTICAL TABULATION 65 '\x0c' # 0x0C -> FORM FEED 66 '\r' # 0x0D -> CARRIAGE RETURN 67 '\x0e' # 0x0E -> SHIFT OUT 68 '\x0f' # 0x0F -> SHIFT IN 69 '\x10' # 0x10 -> DATA LINK ESCAPE 70 '\x11' # 0x11 -> DEVICE CONTROL ONE 71 '\x12' # 0x12 -> DEVICE CONTROL TWO 72 '\x13' # 0x13 -> DEVICE CONTROL THREE 73 '\x14' # 0x14 -> DEVICE CONTROL FOUR 74 '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE 75 '\x16' # 0x16 -> SYNCHRONOUS IDLE 76 '\x17' # 0x17 -> END OF TRANSMISSION BLOCK 77 '\x18' # 0x18 -> CANCEL 78 '\x19' # 0x19 -> END OF MEDIUM 79 '\x1a' # 0x1A -> SUBSTITUTE 80 '\x1b' # 0x1B -> ESCAPE 81 '\x1c' # 0x1C -> FILE SEPARATOR 82 '\x1d' # 0x1D -> GROUP SEPARATOR 83 '\x1e' # 0x1E -> RECORD SEPARATOR 84 '\x1f' # 0x1F -> UNIT SEPARATOR 85 ' ' # 0x20 -> SPACE 86 '!' # 0x21 -> EXCLAMATION MARK 87 '"' # 0x22 -> QUOTATION MARK 88 '#' # 0x23 -> NUMBER SIGN 89 '$' # 0x24 -> DOLLAR SIGN 90 '%' # 0x25 -> PERCENT SIGN 91 '&' # 0x26 -> AMPERSAND 92 "'" # 0x27 -> APOSTROPHE 93 '(' # 0x28 -> LEFT PARENTHESIS 94 ')' # 0x29 -> RIGHT PARENTHESIS 95 '*' # 0x2A -> ASTERISK 96 '+' # 0x2B -> PLUS SIGN 97 ',' # 0x2C -> COMMA 98 '-' # 0x2D -> HYPHEN-MINUS 99 '.' # 0x2E -> FULL STOP 100 '/' # 0x2F -> SOLIDUS 101 '0' # 0x30 -> DIGIT ZERO 102 '1' # 0x31 -> DIGIT ONE 103 '2' # 0x32 -> DIGIT TWO 104 '3' # 0x33 -> DIGIT THREE 105 '4' # 0x34 -> DIGIT FOUR 106 '5' # 0x35 -> DIGIT FIVE 107 '6' # 0x36 -> DIGIT SIX 108 '7' # 0x37 -> DIGIT SEVEN 109 '8' # 0x38 -> DIGIT EIGHT 110 '9' # 0x39 -> DIGIT NINE 111 ':' # 0x3A -> COLON 112 ';' # 0x3B -> SEMICOLON 113 '<' # 0x3C -> LESS-THAN SIGN 114 '=' # 0x3D -> EQUALS SIGN 115 '>' # 0x3E -> GREATER-THAN SIGN 116 '?' # 0x3F -> QUESTION MARK 117 '@' # 0x40 -> COMMERCIAL AT 118 'A' # 0x41 -> LATIN CAPITAL LETTER A 119 'B' # 0x42 -> LATIN CAPITAL LETTER B 120 'C' # 0x43 -> LATIN CAPITAL LETTER C 121 'D' # 0x44 -> LATIN CAPITAL LETTER D 122 'E' # 0x45 -> LATIN CAPITAL LETTER E 123 'F' # 0x46 -> LATIN CAPITAL LETTER F 124 'G' # 0x47 -> LATIN CAPITAL LETTER G 125 'H' # 0x48 -> LATIN CAPITAL LETTER H 126 'I' # 0x49 -> LATIN CAPITAL LETTER I 127 'J' # 0x4A -> LATIN CAPITAL LETTER J 128 'K' # 0x4B -> LATIN CAPITAL LETTER K 129 'L' # 0x4C -> LATIN CAPITAL LETTER L 130 'M' # 0x4D -> LATIN CAPITAL LETTER M 131 'N' # 0x4E -> LATIN CAPITAL LETTER N 132 'O' # 0x4F -> LATIN CAPITAL LETTER O 133 'P' # 0x50 -> LATIN CAPITAL LETTER P 134 'Q' # 0x51 -> LATIN CAPITAL LETTER Q 135 'R' # 0x52 -> LATIN CAPITAL LETTER R 136 'S' # 0x53 -> LATIN CAPITAL LETTER S 137 'T' # 0x54 -> LATIN CAPITAL LETTER T 138 'U' # 0x55 -> LATIN CAPITAL LETTER U 139 'V' # 0x56 -> LATIN CAPITAL LETTER V 140 'W' # 0x57 -> LATIN CAPITAL LETTER W 141 'X' # 0x58 -> LATIN CAPITAL LETTER X 142 'Y' # 0x59 -> LATIN CAPITAL LETTER Y 143 'Z' # 0x5A -> LATIN CAPITAL LETTER Z 144 '[' # 0x5B -> LEFT SQUARE BRACKET 145 '\\' # 0x5C -> REVERSE SOLIDUS 146 ']' # 0x5D -> RIGHT SQUARE BRACKET 147 '^' # 0x5E -> CIRCUMFLEX ACCENT 148 '_' # 0x5F -> LOW LINE 149 '`' # 0x60 -> GRAVE ACCENT 150 'a' # 0x61 -> LATIN SMALL LETTER A 151 'b' # 0x62 -> LATIN SMALL LETTER B 152 'c' # 0x63 -> LATIN SMALL LETTER C 153 'd' # 0x64 -> LATIN SMALL LETTER D 154 'e' # 0x65 -> LATIN SMALL LETTER E 155 'f' # 0x66 -> LATIN SMALL LETTER F 156 'g' # 0x67 -> LATIN SMALL LETTER G 157 'h' # 0x68 -> LATIN SMALL LETTER H 158 'i' # 0x69 -> LATIN SMALL LETTER I 159 'j' # 0x6A -> LATIN SMALL LETTER J 160 'k' # 0x6B -> LATIN SMALL LETTER K 161 'l' # 0x6C -> LATIN SMALL LETTER L 162 'm' # 0x6D -> LATIN SMALL LETTER M 163 'n' # 0x6E -> LATIN SMALL LETTER N 164 'o' # 0x6F -> LATIN SMALL LETTER O 165 'p' # 0x70 -> LATIN SMALL LETTER P 166 'q' # 0x71 -> LATIN SMALL LETTER Q 167 'r' # 0x72 -> LATIN SMALL LETTER R 168 's' # 0x73 -> LATIN SMALL LETTER S 169 't' # 0x74 -> LATIN SMALL LETTER T 170 'u' # 0x75 -> LATIN SMALL LETTER U 171 'v' # 0x76 -> LATIN SMALL LETTER V 172 'w' # 0x77 -> LATIN SMALL LETTER W 173 'x' # 0x78 -> LATIN SMALL LETTER X 174 'y' # 0x79 -> LATIN SMALL LETTER Y 175 'z' # 0x7A -> LATIN SMALL LETTER Z 176 '{' # 0x7B -> LEFT CURLY BRACKET 177 '|' # 0x7C -> VERTICAL LINE 178 '}' # 0x7D -> RIGHT CURLY BRACKET 179 '~' # 0x7E -> TILDE 180 '\x7f' # 0x7F -> DELETE (DEL) 181 '\u0496' # 0x80 -> CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER 182 '\u0492' # 0x81 -> CYRILLIC CAPITAL LETTER GHE WITH STROKE 183 '\u04ee' # 0x82 -> CYRILLIC CAPITAL LETTER U WITH MACRON 184 '\u0493' # 0x83 -> CYRILLIC SMALL LETTER GHE WITH STROKE 185 '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK 186 '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS 187 '\u04b6' # 0x86 -> CYRILLIC CAPITAL LETTER CHE WITH DESCENDER 188 '\u04ae' # 0x87 -> CYRILLIC CAPITAL LETTER STRAIGHT U 189 '\u04b2' # 0x88 -> CYRILLIC CAPITAL LETTER HA WITH DESCENDER 190 '\u04af' # 0x89 -> CYRILLIC SMALL LETTER STRAIGHT U 191 '\u04a0' # 0x8A -> CYRILLIC CAPITAL LETTER BASHKIR KA 192 '\u04e2' # 0x8B -> CYRILLIC CAPITAL LETTER I WITH MACRON 193 '\u04a2' # 0x8C -> CYRILLIC CAPITAL LETTER EN WITH DESCENDER 194 '\u049a' # 0x8D -> CYRILLIC CAPITAL LETTER KA WITH DESCENDER 195 '\u04ba' # 0x8E -> CYRILLIC CAPITAL LETTER SHHA 196 '\u04b8' # 0x8F -> CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE 197 '\u0497' # 0x90 -> CYRILLIC SMALL LETTER ZHE WITH DESCENDER 198 '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK 199 '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK 200 '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK 201 '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK 202 '\u2022' # 0x95 -> BULLET 203 '\u2013' # 0x96 -> EN DASH 204 '\u2014' # 0x97 -> EM DASH 205 '\u04b3' # 0x98 -> CYRILLIC SMALL LETTER HA WITH DESCENDER 206 '\u04b7' # 0x99 -> CYRILLIC SMALL LETTER CHE WITH DESCENDER 207 '\u04a1' # 0x9A -> CYRILLIC SMALL LETTER BASHKIR KA 208 '\u04e3' # 0x9B -> CYRILLIC SMALL LETTER I WITH MACRON 209 '\u04a3' # 0x9C -> CYRILLIC SMALL LETTER EN WITH DESCENDER 210 '\u049b' # 0x9D -> CYRILLIC SMALL LETTER KA WITH DESCENDER 211 '\u04bb' # 0x9E -> CYRILLIC SMALL LETTER SHHA 212 '\u04b9' # 0x9F -> CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE 213 '\xa0' # 0xA0 -> NO-BREAK SPACE 214 '\u040e' # 0xA1 -> CYRILLIC CAPITAL LETTER SHORT U (Byelorussian) 215 '\u045e' # 0xA2 -> CYRILLIC SMALL LETTER SHORT U (Byelorussian) 216 '\u0408' # 0xA3 -> CYRILLIC CAPITAL LETTER JE 217 '\u04e8' # 0xA4 -> CYRILLIC CAPITAL LETTER BARRED O 218 '\u0498' # 0xA5 -> CYRILLIC CAPITAL LETTER ZE WITH DESCENDER 219 '\u04b0' # 0xA6 -> CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE 220 '\xa7' # 0xA7 -> SECTION SIGN 221 '\u0401' # 0xA8 -> CYRILLIC CAPITAL LETTER IO 222 '\xa9' # 0xA9 -> COPYRIGHT SIGN 223 '\u04d8' # 0xAA -> CYRILLIC CAPITAL LETTER SCHWA 224 '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK 225 '\xac' # 0xAC -> NOT SIGN 226 '\u04ef' # 0xAD -> CYRILLIC SMALL LETTER U WITH MACRON 227 '\xae' # 0xAE -> REGISTERED SIGN 228 '\u049c' # 0xAF -> CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE 229 '\xb0' # 0xB0 -> DEGREE SIGN 230 '\u04b1' # 0xB1 -> CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE 231 '\u0406' # 0xB2 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I 232 '\u0456' # 0xB3 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I 233 '\u0499' # 0xB4 -> CYRILLIC SMALL LETTER ZE WITH DESCENDER 234 '\u04e9' # 0xB5 -> CYRILLIC SMALL LETTER BARRED O 235 '\xb6' # 0xB6 -> PILCROW SIGN 236 '\xb7' # 0xB7 -> MIDDLE DOT 237 '\u0451' # 0xB8 -> CYRILLIC SMALL LETTER IO 238 '\u2116' # 0xB9 -> NUMERO SIGN 239 '\u04d9' # 0xBA -> CYRILLIC SMALL LETTER SCHWA 240 '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK 241 '\u0458' # 0xBC -> CYRILLIC SMALL LETTER JE 242 '\u04aa' # 0xBD -> CYRILLIC CAPITAL LETTER ES WITH DESCENDER 243 '\u04ab' # 0xBE -> CYRILLIC SMALL LETTER ES WITH DESCENDER 244 '\u049d' # 0xBF -> CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE 245 '\u0410' # 0xC0 -> CYRILLIC CAPITAL LETTER A 246 '\u0411' # 0xC1 -> CYRILLIC CAPITAL LETTER BE 247 '\u0412' # 0xC2 -> CYRILLIC CAPITAL LETTER VE 248 '\u0413' # 0xC3 -> CYRILLIC CAPITAL LETTER GHE 249 '\u0414' # 0xC4 -> CYRILLIC CAPITAL LETTER DE 250 '\u0415' # 0xC5 -> CYRILLIC CAPITAL LETTER IE 251 '\u0416' # 0xC6 -> CYRILLIC CAPITAL LETTER ZHE 252 '\u0417' # 0xC7 -> CYRILLIC CAPITAL LETTER ZE 253 '\u0418' # 0xC8 -> CYRILLIC CAPITAL LETTER I 254 '\u0419' # 0xC9 -> CYRILLIC CAPITAL LETTER SHORT I 255 '\u041a' # 0xCA -> CYRILLIC CAPITAL LETTER KA 256 '\u041b' # 0xCB -> CYRILLIC CAPITAL LETTER EL 257 '\u041c' # 0xCC -> CYRILLIC CAPITAL LETTER EM 258 '\u041d' # 0xCD -> CYRILLIC CAPITAL LETTER EN 259 '\u041e' # 0xCE -> CYRILLIC CAPITAL LETTER O 260 '\u041f' # 0xCF -> CYRILLIC CAPITAL LETTER PE 261 '\u0420' # 0xD0 -> CYRILLIC CAPITAL LETTER ER 262 '\u0421' # 0xD1 -> CYRILLIC CAPITAL LETTER ES 263 '\u0422' # 0xD2 -> CYRILLIC CAPITAL LETTER TE 264 '\u0423' # 0xD3 -> CYRILLIC CAPITAL LETTER U 265 '\u0424' # 0xD4 -> CYRILLIC CAPITAL LETTER EF 266 '\u0425' # 0xD5 -> CYRILLIC CAPITAL LETTER HA 267 '\u0426' # 0xD6 -> CYRILLIC CAPITAL LETTER TSE 268 '\u0427' # 0xD7 -> CYRILLIC CAPITAL LETTER CHE 269 '\u0428' # 0xD8 -> CYRILLIC CAPITAL LETTER SHA 270 '\u0429' # 0xD9 -> CYRILLIC CAPITAL LETTER SHCHA 271 '\u042a' # 0xDA -> CYRILLIC CAPITAL LETTER HARD SIGN 272 '\u042b' # 0xDB -> CYRILLIC CAPITAL LETTER YERU 273 '\u042c' # 0xDC -> CYRILLIC CAPITAL LETTER SOFT SIGN 274 '\u042d' # 0xDD -> CYRILLIC CAPITAL LETTER E 275 '\u042e' # 0xDE -> CYRILLIC CAPITAL LETTER YU 276 '\u042f' # 0xDF -> CYRILLIC CAPITAL LETTER YA 277 '\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A 278 '\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE 279 '\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE 280 '\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE 281 '\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE 282 '\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE 283 '\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE 284 '\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE 285 '\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I 286 '\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I 287 '\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA 288 '\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL 289 '\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM 290 '\u043d' # 0xED -> CYRILLIC SMALL LETTER EN 291 '\u043e' # 0xEE -> CYRILLIC SMALL LETTER O 292 '\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE 293 '\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER 294 '\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES 295 '\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE 296 '\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U 297 '\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF 298 '\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA 299 '\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE 300 '\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE 301 '\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA 302 '\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA 303 '\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN 304 '\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU 305 '\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN 306 '\u044d' # 0xFD -> CYRILLIC SMALL LETTER E 307 '\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU 308 '\u044f' # 0xFF -> CYRILLIC SMALL LETTER YA 309) 310 311### Encoding table 312encoding_table=codecs.charmap_build(decoding_table) 313