blob: bf7018763eae38729d6c206379467f36e41910c3 [file] [log] [blame]
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +00001#
Hye-Shik Chang2bb146f2004-07-18 03:06:29 +00002# iso2022_kr.py: Python Unicode Codec for ISO2022_KR
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +00003#
4# Written by Hye-Shik Chang <perky@FreeBSD.org>
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +00005#
6
Hye-Shik Chang2bb146f2004-07-18 03:06:29 +00007import _codecs_iso2022, codecs
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00008import _multibytecodec as mbc
Hye-Shik Chang2bb146f2004-07-18 03:06:29 +00009
10codec = _codecs_iso2022.getcodec('iso2022_kr')
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +000011
12class Codec(codecs.Codec):
13 encode = codec.encode
14 decode = codec.decode
15
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000016class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
17 codecs.IncrementalEncoder):
18 codec = codec
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +000019
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000020class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
21 codecs.IncrementalDecoder):
22 codec = codec
23
24class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
25 codec = codec
26
27class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
28 codec = codec
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +000029
30def getregentry():
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000031 return codecs.CodecInfo(
32 name='iso2022_kr',
33 encode=Codec().encode,
34 decode=Codec().decode,
35 incrementalencoder=IncrementalEncoder,
36 incrementaldecoder=IncrementalDecoder,
37 streamreader=StreamReader,
38 streamwriter=StreamWriter,
39 )