blob: 83381172764dea0f76874716cda28852a5906f7f [file] [log] [blame]
Hye-Shik Chang3e2a3062004-01-17 14:29:29 +00001#
2# shift_jis.py: Python Unicode Codec for SHIFT_JIS
3#
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_jp, codecs
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00008import _multibytecodec as mbc
Hye-Shik Chang2bb146f2004-07-18 03:06:29 +00009
10codec = _codecs_jp.getcodec('shift_jis')
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='shift_jis',
33 encode=Codec().encode,
34 decode=Codec().decode,
35 incrementalencoder=IncrementalEncoder,
36 incrementaldecoder=IncrementalDecoder,
37 streamreader=StreamReader,
38 streamwriter=StreamWriter,
39 )