Back to index

python3.2  3.2.2
cp875.py
Go to the documentation of this file.
00001 """ Python Character Mapping Codec cp875 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP875.TXT' with gencodec.py.
00002 
00003 """#"
00004 
00005 import codecs
00006 
00007 ### Codec APIs
00008 
00009 class Codec(codecs.Codec):
00010 
00011     def encode(self,input,errors='strict'):
00012         return codecs.charmap_encode(input,errors,encoding_table)
00013 
00014     def decode(self,input,errors='strict'):
00015         return codecs.charmap_decode(input,errors,decoding_table)
00016 
00017 class IncrementalEncoder(codecs.IncrementalEncoder):
00018     def encode(self, input, final=False):
00019         return codecs.charmap_encode(input,self.errors,encoding_table)[0]
00020 
00021 class IncrementalDecoder(codecs.IncrementalDecoder):
00022     def decode(self, input, final=False):
00023         return codecs.charmap_decode(input,self.errors,decoding_table)[0]
00024 
00025 class StreamWriter(Codec,codecs.StreamWriter):
00026     pass
00027 
00028 class StreamReader(Codec,codecs.StreamReader):
00029     pass
00030 
00031 ### encodings module API
00032 
00033 def getregentry():
00034     return codecs.CodecInfo(
00035         name='cp875',
00036         encode=Codec().encode,
00037         decode=Codec().decode,
00038         incrementalencoder=IncrementalEncoder,
00039         incrementaldecoder=IncrementalDecoder,
00040         streamreader=StreamReader,
00041         streamwriter=StreamWriter,
00042     )
00043 
00044 
00045 ### Decoding Table
00046 
00047 decoding_table = (
00048     '\x00'     #  0x00 -> NULL
00049     '\x01'     #  0x01 -> START OF HEADING
00050     '\x02'     #  0x02 -> START OF TEXT
00051     '\x03'     #  0x03 -> END OF TEXT
00052     '\x9c'     #  0x04 -> CONTROL
00053     '\t'       #  0x05 -> HORIZONTAL TABULATION
00054     '\x86'     #  0x06 -> CONTROL
00055     '\x7f'     #  0x07 -> DELETE
00056     '\x97'     #  0x08 -> CONTROL
00057     '\x8d'     #  0x09 -> CONTROL
00058     '\x8e'     #  0x0A -> CONTROL
00059     '\x0b'     #  0x0B -> VERTICAL TABULATION
00060     '\x0c'     #  0x0C -> FORM FEED
00061     '\r'       #  0x0D -> CARRIAGE RETURN
00062     '\x0e'     #  0x0E -> SHIFT OUT
00063     '\x0f'     #  0x0F -> SHIFT IN
00064     '\x10'     #  0x10 -> DATA LINK ESCAPE
00065     '\x11'     #  0x11 -> DEVICE CONTROL ONE
00066     '\x12'     #  0x12 -> DEVICE CONTROL TWO
00067     '\x13'     #  0x13 -> DEVICE CONTROL THREE
00068     '\x9d'     #  0x14 -> CONTROL
00069     '\x85'     #  0x15 -> CONTROL
00070     '\x08'     #  0x16 -> BACKSPACE
00071     '\x87'     #  0x17 -> CONTROL
00072     '\x18'     #  0x18 -> CANCEL
00073     '\x19'     #  0x19 -> END OF MEDIUM
00074     '\x92'     #  0x1A -> CONTROL
00075     '\x8f'     #  0x1B -> CONTROL
00076     '\x1c'     #  0x1C -> FILE SEPARATOR
00077     '\x1d'     #  0x1D -> GROUP SEPARATOR
00078     '\x1e'     #  0x1E -> RECORD SEPARATOR
00079     '\x1f'     #  0x1F -> UNIT SEPARATOR
00080     '\x80'     #  0x20 -> CONTROL
00081     '\x81'     #  0x21 -> CONTROL
00082     '\x82'     #  0x22 -> CONTROL
00083     '\x83'     #  0x23 -> CONTROL
00084     '\x84'     #  0x24 -> CONTROL
00085     '\n'       #  0x25 -> LINE FEED
00086     '\x17'     #  0x26 -> END OF TRANSMISSION BLOCK
00087     '\x1b'     #  0x27 -> ESCAPE
00088     '\x88'     #  0x28 -> CONTROL
00089     '\x89'     #  0x29 -> CONTROL
00090     '\x8a'     #  0x2A -> CONTROL
00091     '\x8b'     #  0x2B -> CONTROL
00092     '\x8c'     #  0x2C -> CONTROL
00093     '\x05'     #  0x2D -> ENQUIRY
00094     '\x06'     #  0x2E -> ACKNOWLEDGE
00095     '\x07'     #  0x2F -> BELL
00096     '\x90'     #  0x30 -> CONTROL
00097     '\x91'     #  0x31 -> CONTROL
00098     '\x16'     #  0x32 -> SYNCHRONOUS IDLE
00099     '\x93'     #  0x33 -> CONTROL
00100     '\x94'     #  0x34 -> CONTROL
00101     '\x95'     #  0x35 -> CONTROL
00102     '\x96'     #  0x36 -> CONTROL
00103     '\x04'     #  0x37 -> END OF TRANSMISSION
00104     '\x98'     #  0x38 -> CONTROL
00105     '\x99'     #  0x39 -> CONTROL
00106     '\x9a'     #  0x3A -> CONTROL
00107     '\x9b'     #  0x3B -> CONTROL
00108     '\x14'     #  0x3C -> DEVICE CONTROL FOUR
00109     '\x15'     #  0x3D -> NEGATIVE ACKNOWLEDGE
00110     '\x9e'     #  0x3E -> CONTROL
00111     '\x1a'     #  0x3F -> SUBSTITUTE
00112     ' '        #  0x40 -> SPACE
00113     '\u0391'   #  0x41 -> GREEK CAPITAL LETTER ALPHA
00114     '\u0392'   #  0x42 -> GREEK CAPITAL LETTER BETA
00115     '\u0393'   #  0x43 -> GREEK CAPITAL LETTER GAMMA
00116     '\u0394'   #  0x44 -> GREEK CAPITAL LETTER DELTA
00117     '\u0395'   #  0x45 -> GREEK CAPITAL LETTER EPSILON
00118     '\u0396'   #  0x46 -> GREEK CAPITAL LETTER ZETA
00119     '\u0397'   #  0x47 -> GREEK CAPITAL LETTER ETA
00120     '\u0398'   #  0x48 -> GREEK CAPITAL LETTER THETA
00121     '\u0399'   #  0x49 -> GREEK CAPITAL LETTER IOTA
00122     '['        #  0x4A -> LEFT SQUARE BRACKET
00123     '.'        #  0x4B -> FULL STOP
00124     '<'        #  0x4C -> LESS-THAN SIGN
00125     '('        #  0x4D -> LEFT PARENTHESIS
00126     '+'        #  0x4E -> PLUS SIGN
00127     '!'        #  0x4F -> EXCLAMATION MARK
00128     '&'        #  0x50 -> AMPERSAND
00129     '\u039a'   #  0x51 -> GREEK CAPITAL LETTER KAPPA
00130     '\u039b'   #  0x52 -> GREEK CAPITAL LETTER LAMDA
00131     '\u039c'   #  0x53 -> GREEK CAPITAL LETTER MU
00132     '\u039d'   #  0x54 -> GREEK CAPITAL LETTER NU
00133     '\u039e'   #  0x55 -> GREEK CAPITAL LETTER XI
00134     '\u039f'   #  0x56 -> GREEK CAPITAL LETTER OMICRON
00135     '\u03a0'   #  0x57 -> GREEK CAPITAL LETTER PI
00136     '\u03a1'   #  0x58 -> GREEK CAPITAL LETTER RHO
00137     '\u03a3'   #  0x59 -> GREEK CAPITAL LETTER SIGMA
00138     ']'        #  0x5A -> RIGHT SQUARE BRACKET
00139     '$'        #  0x5B -> DOLLAR SIGN
00140     '*'        #  0x5C -> ASTERISK
00141     ')'        #  0x5D -> RIGHT PARENTHESIS
00142     ';'        #  0x5E -> SEMICOLON
00143     '^'        #  0x5F -> CIRCUMFLEX ACCENT
00144     '-'        #  0x60 -> HYPHEN-MINUS
00145     '/'        #  0x61 -> SOLIDUS
00146     '\u03a4'   #  0x62 -> GREEK CAPITAL LETTER TAU
00147     '\u03a5'   #  0x63 -> GREEK CAPITAL LETTER UPSILON
00148     '\u03a6'   #  0x64 -> GREEK CAPITAL LETTER PHI
00149     '\u03a7'   #  0x65 -> GREEK CAPITAL LETTER CHI
00150     '\u03a8'   #  0x66 -> GREEK CAPITAL LETTER PSI
00151     '\u03a9'   #  0x67 -> GREEK CAPITAL LETTER OMEGA
00152     '\u03aa'   #  0x68 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
00153     '\u03ab'   #  0x69 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
00154     '|'        #  0x6A -> VERTICAL LINE
00155     ','        #  0x6B -> COMMA
00156     '%'        #  0x6C -> PERCENT SIGN
00157     '_'        #  0x6D -> LOW LINE
00158     '>'        #  0x6E -> GREATER-THAN SIGN
00159     '?'        #  0x6F -> QUESTION MARK
00160     '\xa8'     #  0x70 -> DIAERESIS
00161     '\u0386'   #  0x71 -> GREEK CAPITAL LETTER ALPHA WITH TONOS
00162     '\u0388'   #  0x72 -> GREEK CAPITAL LETTER EPSILON WITH TONOS
00163     '\u0389'   #  0x73 -> GREEK CAPITAL LETTER ETA WITH TONOS
00164     '\xa0'     #  0x74 -> NO-BREAK SPACE
00165     '\u038a'   #  0x75 -> GREEK CAPITAL LETTER IOTA WITH TONOS
00166     '\u038c'   #  0x76 -> GREEK CAPITAL LETTER OMICRON WITH TONOS
00167     '\u038e'   #  0x77 -> GREEK CAPITAL LETTER UPSILON WITH TONOS
00168     '\u038f'   #  0x78 -> GREEK CAPITAL LETTER OMEGA WITH TONOS
00169     '`'        #  0x79 -> GRAVE ACCENT
00170     ':'        #  0x7A -> COLON
00171     '#'        #  0x7B -> NUMBER SIGN
00172     '@'        #  0x7C -> COMMERCIAL AT
00173     "'"        #  0x7D -> APOSTROPHE
00174     '='        #  0x7E -> EQUALS SIGN
00175     '"'        #  0x7F -> QUOTATION MARK
00176     '\u0385'   #  0x80 -> GREEK DIALYTIKA TONOS
00177     'a'        #  0x81 -> LATIN SMALL LETTER A
00178     'b'        #  0x82 -> LATIN SMALL LETTER B
00179     'c'        #  0x83 -> LATIN SMALL LETTER C
00180     'd'        #  0x84 -> LATIN SMALL LETTER D
00181     'e'        #  0x85 -> LATIN SMALL LETTER E
00182     'f'        #  0x86 -> LATIN SMALL LETTER F
00183     'g'        #  0x87 -> LATIN SMALL LETTER G
00184     'h'        #  0x88 -> LATIN SMALL LETTER H
00185     'i'        #  0x89 -> LATIN SMALL LETTER I
00186     '\u03b1'   #  0x8A -> GREEK SMALL LETTER ALPHA
00187     '\u03b2'   #  0x8B -> GREEK SMALL LETTER BETA
00188     '\u03b3'   #  0x8C -> GREEK SMALL LETTER GAMMA
00189     '\u03b4'   #  0x8D -> GREEK SMALL LETTER DELTA
00190     '\u03b5'   #  0x8E -> GREEK SMALL LETTER EPSILON
00191     '\u03b6'   #  0x8F -> GREEK SMALL LETTER ZETA
00192     '\xb0'     #  0x90 -> DEGREE SIGN
00193     'j'        #  0x91 -> LATIN SMALL LETTER J
00194     'k'        #  0x92 -> LATIN SMALL LETTER K
00195     'l'        #  0x93 -> LATIN SMALL LETTER L
00196     'm'        #  0x94 -> LATIN SMALL LETTER M
00197     'n'        #  0x95 -> LATIN SMALL LETTER N
00198     'o'        #  0x96 -> LATIN SMALL LETTER O
00199     'p'        #  0x97 -> LATIN SMALL LETTER P
00200     'q'        #  0x98 -> LATIN SMALL LETTER Q
00201     'r'        #  0x99 -> LATIN SMALL LETTER R
00202     '\u03b7'   #  0x9A -> GREEK SMALL LETTER ETA
00203     '\u03b8'   #  0x9B -> GREEK SMALL LETTER THETA
00204     '\u03b9'   #  0x9C -> GREEK SMALL LETTER IOTA
00205     '\u03ba'   #  0x9D -> GREEK SMALL LETTER KAPPA
00206     '\u03bb'   #  0x9E -> GREEK SMALL LETTER LAMDA
00207     '\u03bc'   #  0x9F -> GREEK SMALL LETTER MU
00208     '\xb4'     #  0xA0 -> ACUTE ACCENT
00209     '~'        #  0xA1 -> TILDE
00210     's'        #  0xA2 -> LATIN SMALL LETTER S
00211     't'        #  0xA3 -> LATIN SMALL LETTER T
00212     'u'        #  0xA4 -> LATIN SMALL LETTER U
00213     'v'        #  0xA5 -> LATIN SMALL LETTER V
00214     'w'        #  0xA6 -> LATIN SMALL LETTER W
00215     'x'        #  0xA7 -> LATIN SMALL LETTER X
00216     'y'        #  0xA8 -> LATIN SMALL LETTER Y
00217     'z'        #  0xA9 -> LATIN SMALL LETTER Z
00218     '\u03bd'   #  0xAA -> GREEK SMALL LETTER NU
00219     '\u03be'   #  0xAB -> GREEK SMALL LETTER XI
00220     '\u03bf'   #  0xAC -> GREEK SMALL LETTER OMICRON
00221     '\u03c0'   #  0xAD -> GREEK SMALL LETTER PI
00222     '\u03c1'   #  0xAE -> GREEK SMALL LETTER RHO
00223     '\u03c3'   #  0xAF -> GREEK SMALL LETTER SIGMA
00224     '\xa3'     #  0xB0 -> POUND SIGN
00225     '\u03ac'   #  0xB1 -> GREEK SMALL LETTER ALPHA WITH TONOS
00226     '\u03ad'   #  0xB2 -> GREEK SMALL LETTER EPSILON WITH TONOS
00227     '\u03ae'   #  0xB3 -> GREEK SMALL LETTER ETA WITH TONOS
00228     '\u03ca'   #  0xB4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA
00229     '\u03af'   #  0xB5 -> GREEK SMALL LETTER IOTA WITH TONOS
00230     '\u03cc'   #  0xB6 -> GREEK SMALL LETTER OMICRON WITH TONOS
00231     '\u03cd'   #  0xB7 -> GREEK SMALL LETTER UPSILON WITH TONOS
00232     '\u03cb'   #  0xB8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA
00233     '\u03ce'   #  0xB9 -> GREEK SMALL LETTER OMEGA WITH TONOS
00234     '\u03c2'   #  0xBA -> GREEK SMALL LETTER FINAL SIGMA
00235     '\u03c4'   #  0xBB -> GREEK SMALL LETTER TAU
00236     '\u03c5'   #  0xBC -> GREEK SMALL LETTER UPSILON
00237     '\u03c6'   #  0xBD -> GREEK SMALL LETTER PHI
00238     '\u03c7'   #  0xBE -> GREEK SMALL LETTER CHI
00239     '\u03c8'   #  0xBF -> GREEK SMALL LETTER PSI
00240     '{'        #  0xC0 -> LEFT CURLY BRACKET
00241     'A'        #  0xC1 -> LATIN CAPITAL LETTER A
00242     'B'        #  0xC2 -> LATIN CAPITAL LETTER B
00243     'C'        #  0xC3 -> LATIN CAPITAL LETTER C
00244     'D'        #  0xC4 -> LATIN CAPITAL LETTER D
00245     'E'        #  0xC5 -> LATIN CAPITAL LETTER E
00246     'F'        #  0xC6 -> LATIN CAPITAL LETTER F
00247     'G'        #  0xC7 -> LATIN CAPITAL LETTER G
00248     'H'        #  0xC8 -> LATIN CAPITAL LETTER H
00249     'I'        #  0xC9 -> LATIN CAPITAL LETTER I
00250     '\xad'     #  0xCA -> SOFT HYPHEN
00251     '\u03c9'   #  0xCB -> GREEK SMALL LETTER OMEGA
00252     '\u0390'   #  0xCC -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
00253     '\u03b0'   #  0xCD -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
00254     '\u2018'   #  0xCE -> LEFT SINGLE QUOTATION MARK
00255     '\u2015'   #  0xCF -> HORIZONTAL BAR
00256     '}'        #  0xD0 -> RIGHT CURLY BRACKET
00257     'J'        #  0xD1 -> LATIN CAPITAL LETTER J
00258     'K'        #  0xD2 -> LATIN CAPITAL LETTER K
00259     'L'        #  0xD3 -> LATIN CAPITAL LETTER L
00260     'M'        #  0xD4 -> LATIN CAPITAL LETTER M
00261     'N'        #  0xD5 -> LATIN CAPITAL LETTER N
00262     'O'        #  0xD6 -> LATIN CAPITAL LETTER O
00263     'P'        #  0xD7 -> LATIN CAPITAL LETTER P
00264     'Q'        #  0xD8 -> LATIN CAPITAL LETTER Q
00265     'R'        #  0xD9 -> LATIN CAPITAL LETTER R
00266     '\xb1'     #  0xDA -> PLUS-MINUS SIGN
00267     '\xbd'     #  0xDB -> VULGAR FRACTION ONE HALF
00268     '\x1a'     #  0xDC -> SUBSTITUTE
00269     '\u0387'   #  0xDD -> GREEK ANO TELEIA
00270     '\u2019'   #  0xDE -> RIGHT SINGLE QUOTATION MARK
00271     '\xa6'     #  0xDF -> BROKEN BAR
00272     '\\'       #  0xE0 -> REVERSE SOLIDUS
00273     '\x1a'     #  0xE1 -> SUBSTITUTE
00274     'S'        #  0xE2 -> LATIN CAPITAL LETTER S
00275     'T'        #  0xE3 -> LATIN CAPITAL LETTER T
00276     'U'        #  0xE4 -> LATIN CAPITAL LETTER U
00277     'V'        #  0xE5 -> LATIN CAPITAL LETTER V
00278     'W'        #  0xE6 -> LATIN CAPITAL LETTER W
00279     'X'        #  0xE7 -> LATIN CAPITAL LETTER X
00280     'Y'        #  0xE8 -> LATIN CAPITAL LETTER Y
00281     'Z'        #  0xE9 -> LATIN CAPITAL LETTER Z
00282     '\xb2'     #  0xEA -> SUPERSCRIPT TWO
00283     '\xa7'     #  0xEB -> SECTION SIGN
00284     '\x1a'     #  0xEC -> SUBSTITUTE
00285     '\x1a'     #  0xED -> SUBSTITUTE
00286     '\xab'     #  0xEE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
00287     '\xac'     #  0xEF -> NOT SIGN
00288     '0'        #  0xF0 -> DIGIT ZERO
00289     '1'        #  0xF1 -> DIGIT ONE
00290     '2'        #  0xF2 -> DIGIT TWO
00291     '3'        #  0xF3 -> DIGIT THREE
00292     '4'        #  0xF4 -> DIGIT FOUR
00293     '5'        #  0xF5 -> DIGIT FIVE
00294     '6'        #  0xF6 -> DIGIT SIX
00295     '7'        #  0xF7 -> DIGIT SEVEN
00296     '8'        #  0xF8 -> DIGIT EIGHT
00297     '9'        #  0xF9 -> DIGIT NINE
00298     '\xb3'     #  0xFA -> SUPERSCRIPT THREE
00299     '\xa9'     #  0xFB -> COPYRIGHT SIGN
00300     '\x1a'     #  0xFC -> SUBSTITUTE
00301     '\x1a'     #  0xFD -> SUBSTITUTE
00302     '\xbb'     #  0xFE -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
00303     '\x9f'     #  0xFF -> CONTROL
00304 )
00305 
00306 ### Encoding table
00307 encoding_table=codecs.charmap_build(decoding_table)