diff options
author | Hye-Shik Chang <hyeshik@gmail.com> | 2004-01-17 14:29:29 (GMT) |
---|---|---|
committer | Hye-Shik Chang <hyeshik@gmail.com> | 2004-01-17 14:29:29 (GMT) |
commit | 3e2a30692085d32ac63f72b35da39158a471fc68 (patch) | |
tree | 4cbe735f61eae87ac56a13ca6bd32113b98bd03d /Lib/encodings | |
parent | cd1f7430cb8f48de970021071d7683054c23b10f (diff) | |
download | cpython-3e2a30692085d32ac63f72b35da39158a471fc68.zip cpython-3e2a30692085d32ac63f72b35da39158a471fc68.tar.gz cpython-3e2a30692085d32ac63f72b35da39158a471fc68.tar.bz2 |
Add CJK codecs support as discussed on python-dev. (SF #873597)
Several style fixes are suggested by Martin v. Loewis and
Marc-Andre Lemburg. Thanks!
Diffstat (limited to 'Lib/encodings')
-rw-r--r-- | Lib/encodings/aliases.py | 109 | ||||
-rw-r--r-- | Lib/encodings/big5.py | 34 | ||||
-rw-r--r-- | Lib/encodings/cp932.py | 34 | ||||
-rw-r--r-- | Lib/encodings/cp949.py | 34 | ||||
-rw-r--r-- | Lib/encodings/cp950.py | 34 | ||||
-rw-r--r-- | Lib/encodings/euc_jisx0213.py | 34 | ||||
-rw-r--r-- | Lib/encodings/euc_jp.py | 34 | ||||
-rw-r--r-- | Lib/encodings/euc_kr.py | 34 | ||||
-rw-r--r-- | Lib/encodings/gb18030.py | 34 | ||||
-rw-r--r-- | Lib/encodings/gb2312.py | 34 | ||||
-rw-r--r-- | Lib/encodings/gbk.py | 34 | ||||
-rw-r--r-- | Lib/encodings/hz.py | 34 | ||||
-rw-r--r-- | Lib/encodings/iso2022_jp.py | 34 | ||||
-rw-r--r-- | Lib/encodings/iso2022_jp_1.py | 34 | ||||
-rw-r--r-- | Lib/encodings/iso2022_jp_2.py | 34 | ||||
-rw-r--r-- | Lib/encodings/iso2022_jp_3.py | 34 | ||||
-rw-r--r-- | Lib/encodings/iso2022_jp_ext.py | 34 | ||||
-rw-r--r-- | Lib/encodings/iso2022_kr.py | 34 | ||||
-rw-r--r-- | Lib/encodings/johab.py | 34 | ||||
-rw-r--r-- | Lib/encodings/shift_jis.py | 34 | ||||
-rw-r--r-- | Lib/encodings/shift_jisx0213.py | 34 |
21 files changed, 780 insertions, 9 deletions
diff --git a/Lib/encodings/aliases.py b/Lib/encodings/aliases.py index b304f15..0594171 100644 --- a/Lib/encodings/aliases.py +++ b/Lib/encodings/aliases.py @@ -14,12 +14,6 @@ codecs. In addition to these, a few Python specific codec aliases have also been added. - About the CJK codec aliases: - - The codecs for these encodings are not distributed with the - Python core, but are included here for reference, since the - locale module relies on having these aliases available. - """ aliases = { @@ -41,6 +35,10 @@ aliases = { 'base64' : 'base64_codec', 'base_64' : 'base64_codec', + # big5 codec + 'big5_tw' : 'big5', + 'csbig5' : 'big5', + # bz2_codec codec 'bz2' : 'bz2_codec', @@ -168,9 +166,91 @@ aliases = { 'csibm869' : 'cp869', 'ibm869' : 'cp869', + # cp932 codec + '932' : 'cp932', + 'ms932' : 'cp932', + 'mskanji' : 'cp932', + 'ms_kanji' : 'cp932', + + # cp949 codec + '949' : 'cp949', + 'ms949' : 'cp949', + 'uhc' : 'cp949', + + # cp950 codec + '950' : 'cp950', + 'ms950' : 'cp950', + + # euc_jisx0213 codec + 'jisx0213' : 'euc_jisx0213', + 'eucjisx0213' : 'euc_jisx0213', + + # euc_jp codec + 'eucjp' : 'euc_jp', + 'ujis' : 'euc_jp', + 'u_jis' : 'euc_jp', + + # euc_kr codec + 'euckr' : 'euc_kr', + 'korean' : 'euc_kr', + 'ksc5601' : 'euc_kr', + 'ks_c_5601' : 'euc_kr', + 'ks_c_5601_1987' : 'euc_kr', + 'ksx1001' : 'euc_kr', + 'ks_x_1001' : 'euc_kr', + + # gb18030 codec + 'gb18030_2000' : 'gb18030', + + # gb2312 codec + 'chinese' : 'gb2312', + 'csiso58gb231280' : 'gb2312', + 'euc_cn' : 'gb2312', + 'euccn' : 'gb2312', + 'eucgb2312_cn' : 'gb2312', + 'gb2312_1980' : 'gb2312', + 'gb2312_80' : 'gb2312', + 'iso_ir_58' : 'gb2312', + + # gbk codec + '936' : 'gbk', + 'cp936' : 'gbk', + 'ms936' : 'gbk', + # hex_codec codec 'hex' : 'hex_codec', + # hz codec + 'hzgb' : 'hz', + 'hz_gb' : 'hz', + 'hz_gb_2312' : 'hz', + + # iso2022_jp codec + 'csiso2022jp' : 'iso2022_jp', + 'iso2022jp' : 'iso2022_jp', + 'iso_2022_jp' : 'iso2022_jp', + + # iso2022_jp_1 codec + 'iso2022jp_1' : 'iso2022_jp_1', + 'iso_2022_jp_1' : 'iso2022_jp_1', + + # iso2022_jp_2 codec + 'iso2022jp_2' : 'iso2022_jp_2', + 'iso_2022_jp_2' : 'iso2022_jp_2', + + # iso_3022_jp_3 codec + 'iso2022jp_3' : 'iso2022_jp_3', + 'iso_2022_jp_3' : 'iso2022_jp_3', + + # iso2022_jp_ext codec + 'iso2022jp_ext' : 'iso2022_jp_ext', + 'iso_2022_jp_ext' : 'iso2022_jp_ext', + + # iso2022_kr codec + 'csiso2022kr' : 'iso2022_kr', + 'iso2022kr' : 'iso2022_kr', + 'iso_2022_kr' : 'iso2022_kr', + # iso8859_10 codec 'csisolatin6' : 'iso8859_10', 'iso_8859_10' : 'iso8859_10', @@ -258,9 +338,9 @@ aliases = { 'l5' : 'iso8859_9', 'latin5' : 'iso8859_9', - # jis_7 codec - 'csiso2022jp' : 'jis_7', - 'iso_2022_jp' : 'jis_7', + # johab codec + 'cp1361' : 'johab', + 'ms1361' : 'johab', # koi8_r codec 'cskoi8r' : 'koi8_r', @@ -308,6 +388,17 @@ aliases = { # rot_13 codec 'rot13' : 'rot_13', + # shift_jis codec + 'csshiftjis' : 'shift_jis', + 'shiftjis' : 'shift_jis', + 'sjis' : 'shift_jis', + 's_jis' : 'shift_jis', + + # shift_jisx0213 codec + 'shiftjisx0213' : 'shift_jisx0213', + 'sjisx0213' : 'shift_jisx0213', + 's_jisx0213' : 'shift_jisx0213', + # tactis codec 'tis260' : 'tactis', diff --git a/Lib/encodings/big5.py b/Lib/encodings/big5.py new file mode 100644 index 0000000..2346274 --- /dev/null +++ b/Lib/encodings/big5.py @@ -0,0 +1,34 @@ +# +# big5.py: Python Unicode Codec for BIG5 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: big5.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_big5 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/cp932.py b/Lib/encodings/cp932.py new file mode 100644 index 0000000..4bd8894 --- /dev/null +++ b/Lib/encodings/cp932.py @@ -0,0 +1,34 @@ +# +# cp932.py: Python Unicode Codec for CP932 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: cp932.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_cp932 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/cp949.py b/Lib/encodings/cp949.py new file mode 100644 index 0000000..0a0b009 --- /dev/null +++ b/Lib/encodings/cp949.py @@ -0,0 +1,34 @@ +# +# cp949.py: Python Unicode Codec for CP949 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: cp949.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_cp949 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/cp950.py b/Lib/encodings/cp950.py new file mode 100644 index 0000000..a3b6c0e --- /dev/null +++ b/Lib/encodings/cp950.py @@ -0,0 +1,34 @@ +# +# cp950.py: Python Unicode Codec for CP950 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: cp950.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_cp950 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/euc_jisx0213.py b/Lib/encodings/euc_jisx0213.py new file mode 100644 index 0000000..d54e864 --- /dev/null +++ b/Lib/encodings/euc_jisx0213.py @@ -0,0 +1,34 @@ +# +# euc_jisx0213.py: Python Unicode Codec for EUC_JISX0213 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: euc_jisx0213.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_euc_jisx0213 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/euc_jp.py b/Lib/encodings/euc_jp.py new file mode 100644 index 0000000..ff3b155 --- /dev/null +++ b/Lib/encodings/euc_jp.py @@ -0,0 +1,34 @@ +# +# euc_jp.py: Python Unicode Codec for EUC_JP +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: euc_jp.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_euc_jp import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/euc_kr.py b/Lib/encodings/euc_kr.py new file mode 100644 index 0000000..7ad237e --- /dev/null +++ b/Lib/encodings/euc_kr.py @@ -0,0 +1,34 @@ +# +# euc_kr.py: Python Unicode Codec for EUC_KR +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: euc_kr.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_euc_kr import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/gb18030.py b/Lib/encodings/gb18030.py new file mode 100644 index 0000000..921ab50 --- /dev/null +++ b/Lib/encodings/gb18030.py @@ -0,0 +1,34 @@ +# +# gb18030.py: Python Unicode Codec for GB18030 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: gb18030.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_gb18030 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/gb2312.py b/Lib/encodings/gb2312.py new file mode 100644 index 0000000..8f8bfd1 --- /dev/null +++ b/Lib/encodings/gb2312.py @@ -0,0 +1,34 @@ +# +# gb2312.py: Python Unicode Codec for GB2312 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: gb2312.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_gb2312 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/gbk.py b/Lib/encodings/gbk.py new file mode 100644 index 0000000..557058d --- /dev/null +++ b/Lib/encodings/gbk.py @@ -0,0 +1,34 @@ +# +# gbk.py: Python Unicode Codec for GBK +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: gbk.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_gbk import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/hz.py b/Lib/encodings/hz.py new file mode 100644 index 0000000..0e87a56 --- /dev/null +++ b/Lib/encodings/hz.py @@ -0,0 +1,34 @@ +# +# hz.py: Python Unicode Codec for HZ +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: hz.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_hz import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/iso2022_jp.py b/Lib/encodings/iso2022_jp.py new file mode 100644 index 0000000..c3f3150 --- /dev/null +++ b/Lib/encodings/iso2022_jp.py @@ -0,0 +1,34 @@ +# +# iso2022_jp.py: Python Unicode Codec for ISO_2022_JP +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: iso2022_jp.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_iso2022_jp import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/iso2022_jp_1.py b/Lib/encodings/iso2022_jp_1.py new file mode 100644 index 0000000..292cc9c --- /dev/null +++ b/Lib/encodings/iso2022_jp_1.py @@ -0,0 +1,34 @@ +# +# iso2022_jp_1.py: Python Unicode Codec for ISO_2022_JP_1 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: iso2022_jp_1.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_iso2022_jp_1 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/iso2022_jp_2.py b/Lib/encodings/iso2022_jp_2.py new file mode 100644 index 0000000..8fb0aba --- /dev/null +++ b/Lib/encodings/iso2022_jp_2.py @@ -0,0 +1,34 @@ +# +# iso2022_jp_2.py: Python Unicode Codec for ISO_2022_JP_2 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: iso2022_jp_2.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_iso2022_jp_2 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/iso2022_jp_3.py b/Lib/encodings/iso2022_jp_3.py new file mode 100644 index 0000000..49bde5e --- /dev/null +++ b/Lib/encodings/iso2022_jp_3.py @@ -0,0 +1,34 @@ +# +# iso2022_jp_3.py: Python Unicode Codec for ISO_2022_JP_3 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: iso2022_jp_3.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_iso2022_jp_3 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/iso2022_jp_ext.py b/Lib/encodings/iso2022_jp_ext.py new file mode 100644 index 0000000..9ac10ce --- /dev/null +++ b/Lib/encodings/iso2022_jp_ext.py @@ -0,0 +1,34 @@ +# +# iso2022_jp_ext.py: Python Unicode Codec for ISO_2022_JP_EXT +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: iso2022_jp_ext.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_iso2022_jp_ext import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/iso2022_kr.py b/Lib/encodings/iso2022_kr.py new file mode 100644 index 0000000..76cb92e --- /dev/null +++ b/Lib/encodings/iso2022_kr.py @@ -0,0 +1,34 @@ +# +# iso2022_kr.py: Python Unicode Codec for ISO_2022_KR +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: iso2022_kr.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_iso2022_kr import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/johab.py b/Lib/encodings/johab.py new file mode 100644 index 0000000..f969d58 --- /dev/null +++ b/Lib/encodings/johab.py @@ -0,0 +1,34 @@ +# +# johab.py: Python Unicode Codec for JOHAB +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: johab.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_johab import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/shift_jis.py b/Lib/encodings/shift_jis.py new file mode 100644 index 0000000..3ee23ea --- /dev/null +++ b/Lib/encodings/shift_jis.py @@ -0,0 +1,34 @@ +# +# shift_jis.py: Python Unicode Codec for SHIFT_JIS +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: shift_jis.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_shift_jis import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + diff --git a/Lib/encodings/shift_jisx0213.py b/Lib/encodings/shift_jisx0213.py new file mode 100644 index 0000000..a32e855 --- /dev/null +++ b/Lib/encodings/shift_jisx0213.py @@ -0,0 +1,34 @@ +# +# shift_jisx0213.py: Python Unicode Codec for SHIFT_JISX0213 +# +# Written by Hye-Shik Chang <perky@FreeBSD.org> +# $CJKCodecs: shift_jisx0213.py,v 1.3 2004/01/17 11:26:10 perky Exp $ +# + +from _codecs_shift_jisx0213 import codec +import codecs + +class Codec(codecs.Codec): + encode = codec.encode + decode = codec.decode + +class StreamReader(Codec, codecs.StreamReader): + def __init__(self, stream, errors='strict'): + codecs.StreamReader.__init__(self, stream, errors) + __codec = codec.StreamReader(stream, errors) + self.read = __codec.read + self.readline = __codec.readline + self.readlines = __codec.readlines + self.reset = __codec.reset + +class StreamWriter(Codec, codecs.StreamWriter): + def __init__(self, stream, errors='strict'): + codecs.StreamWriter.__init__(self, stream, errors) + __codec = codec.StreamWriter(stream, errors) + self.write = __codec.write + self.writelines = __codec.writelines + self.reset = __codec.reset + +def getregentry(): + return (Codec().encode,Codec().decode,StreamReader,StreamWriter) + |