0001 """ Python Character Mapping Codec for cp1140 0002 0003 Written by Brian Quinlan(brian@sweetapp.com). NO WARRANTY. 0004 """ 0005 0006 import codecs 0007 import copy 0008 import cp037 0009 0010 ### Codec APIs 0011 0012 class Codec(codecs.Codec): 0013 0014 def encode(self,input,errors='strict'): 0015 0016 return codecs.charmap_encode(input,errors,encoding_map) 0017 0018 def decode(self,input,errors='strict'): 0019 0020 return codecs.charmap_decode(input,errors,decoding_map) 0021 0022 class StreamWriter(Codec,codecs.StreamWriter): 0023 pass 0024 0025 class StreamReader(Codec,codecs.StreamReader): 0026 pass 0027 0028 ### encodings module API 0029 0030 def getregentry(): 0031 0032 return (Codec().encode,Codec().decode,StreamReader,StreamWriter) 0033 0034 ### Decoding Map 0035 0036 decoding_map = copy.copy(cp037.decoding_map) 0037 0038 decoding_map.update({ 0039 0x009f: 0x20ac # EURO SIGN 0040 }) 0041 0042 ### Encoding Map 0043 0044 encoding_map = codecs.make_encoding_map(decoding_map) 0045
Generated by PyXR 0.9.4