PyXR

c:\python24\lib \ encodings \ koi8_u.py



0001 """ Python Character Mapping Codec for KOI8U.
0002 
0003     This character scheme is compliant to RFC2319
0004 
0005 Written by Marc-Andre Lemburg (mal@lemburg.com).
0006 Modified by Maxim Dzumanenko <mvd@mylinux.com.ua>.
0007 
0008 (c) Copyright 2002, Python Software Foundation.
0009 
0010 """#"
0011 
0012 import codecs, koi8_r
0013 
0014 ### Codec APIs
0015 
0016 class Codec(codecs.Codec):
0017 
0018     def encode(self,input,errors='strict'):
0019 
0020         return codecs.charmap_encode(input,errors,encoding_map)
0021 
0022     def decode(self,input,errors='strict'):
0023 
0024         return codecs.charmap_decode(input,errors,decoding_map)
0025 
0026 class StreamWriter(Codec,codecs.StreamWriter):
0027     pass
0028 
0029 class StreamReader(Codec,codecs.StreamReader):
0030     pass
0031 
0032 ### encodings module API
0033 
0034 def getregentry():
0035 
0036     return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
0037 
0038 ### Decoding Map
0039 
0040 decoding_map = koi8_r.decoding_map.copy()
0041 decoding_map.update({
0042         0x00a4: 0x0454, #       CYRILLIC SMALL LETTER UKRAINIAN IE
0043         0x00a6: 0x0456, #       CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
0044         0x00a7: 0x0457, #       CYRILLIC SMALL LETTER YI (UKRAINIAN)
0045         0x00ad: 0x0491, #       CYRILLIC SMALL LETTER UKRAINIAN GHE WITH UPTURN
0046         0x00b4: 0x0404, #       CYRILLIC CAPITAL LETTER UKRAINIAN IE
0047         0x00b6: 0x0406, #       CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
0048         0x00b7: 0x0407, #       CYRILLIC CAPITAL LETTER YI (UKRAINIAN)
0049         0x00bd: 0x0490, #       CYRILLIC CAPITAL LETTER UKRAINIAN GHE WITH UPTURN
0050 })
0051 
0052 ### Encoding Map
0053 
0054 encoding_map = codecs.make_encoding_map(decoding_map)
0055 

Generated by PyXR 0.9.4
SourceForge.net Logo