summaryrefslogtreecommitdiffstats
path: root/Lib/encodings
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2004-07-18 03:06:29 (GMT)
committerHye-Shik Chang <hyeshik@gmail.com>2004-07-18 03:06:29 (GMT)
commit2bb146f2f4fd52b03cfa7ae739adb35d2b9f5421 (patch)
treeebd4c873cfc841dc978053941b2859d4efbd9082 /Lib/encodings
parent264c659197bcd2fc3e22776fc711f31b953daae5 (diff)
downloadcpython-2bb146f2f4fd52b03cfa7ae739adb35d2b9f5421.zip
cpython-2bb146f2f4fd52b03cfa7ae739adb35d2b9f5421.tar.gz
cpython-2bb146f2f4fd52b03cfa7ae739adb35d2b9f5421.tar.bz2
Bring CJKCodecs 1.1 into trunk. This completely reorganizes source
and installed layouts to make maintenance simple and easy. And it also adds four new codecs; big5hkscs, euc-jis-2004, shift-jis-2004 and iso2022-jp-2004.
Diffstat (limited to 'Lib/encodings')
-rw-r--r--Lib/encodings/aliases.py19
-rw-r--r--Lib/encodings/big5.py9
-rw-r--r--Lib/encodings/big5hkscs.py34
-rw-r--r--Lib/encodings/cp932.py9
-rw-r--r--Lib/encodings/cp949.py9
-rw-r--r--Lib/encodings/cp950.py9
-rw-r--r--Lib/encodings/euc_jis_2004.py34
-rw-r--r--Lib/encodings/euc_jisx0213.py9
-rw-r--r--Lib/encodings/euc_jp.py9
-rw-r--r--Lib/encodings/euc_kr.py9
-rw-r--r--Lib/encodings/gb18030.py9
-rw-r--r--Lib/encodings/gb2312.py9
-rw-r--r--Lib/encodings/gbk.py9
-rw-r--r--Lib/encodings/hz.py9
-rw-r--r--Lib/encodings/iso2022_jp.py11
-rw-r--r--Lib/encodings/iso2022_jp_1.py11
-rw-r--r--Lib/encodings/iso2022_jp_2.py11
-rw-r--r--Lib/encodings/iso2022_jp_2004.py34
-rw-r--r--Lib/encodings/iso2022_jp_3.py11
-rw-r--r--Lib/encodings/iso2022_jp_ext.py11
-rw-r--r--Lib/encodings/iso2022_kr.py11
-rw-r--r--Lib/encodings/johab.py9
-rw-r--r--Lib/encodings/shift_jis.py9
-rw-r--r--Lib/encodings/shift_jis_2004.py34
-rw-r--r--Lib/encodings/shift_jisx0213.py9
25 files changed, 260 insertions, 87 deletions
diff --git a/Lib/encodings/aliases.py b/Lib/encodings/aliases.py
index 579cf17..79f3cc6 100644
--- a/Lib/encodings/aliases.py
+++ b/Lib/encodings/aliases.py
@@ -39,6 +39,10 @@ aliases = {
'big5_tw' : 'big5',
'csbig5' : 'big5',
+ # big5hkscs codec
+ 'big5_hkscs' : 'big5hkscs',
+ 'hkscs' : 'big5hkscs',
+
# bz2_codec codec
'bz2' : 'bz2_codec',
@@ -197,8 +201,12 @@ aliases = {
'950' : 'cp950',
'ms950' : 'cp950',
+ # euc_jis_2004 codec
+ 'jisx0213' : 'euc_jis_2004',
+ 'eucjis2004' : 'euc_jis_2004',
+ 'euc_jis2004' : 'euc_jis_2004',
+
# euc_jisx0213 codec
- 'jisx0213' : 'euc_jisx0213',
'eucjisx0213' : 'euc_jisx0213',
# euc_jp codec
@@ -254,6 +262,10 @@ aliases = {
'iso2022jp_2' : 'iso2022_jp_2',
'iso_2022_jp_2' : 'iso2022_jp_2',
+ # iso2022_jp_2004 codec
+ 'iso_2022_jp_2004' : 'iso2022_jp_2004',
+ 'iso2022jp_2004' : 'iso2022_jp_2004',
+
# iso2022_jp_3 codec
'iso2022jp_3' : 'iso2022_jp_3',
'iso_2022_jp_3' : 'iso2022_jp_3',
@@ -416,6 +428,11 @@ aliases = {
'sjis' : 'shift_jis',
's_jis' : 'shift_jis',
+ # shift_jis_2004 codec
+ 'shiftjis2004' : 'shift_jis_2004',
+ 'sjis_2004' : 'shift_jis_2004',
+ 's_jis_2004' : 'shift_jis_2004',
+
# shift_jisx0213 codec
'shiftjisx0213' : 'shift_jisx0213',
'sjisx0213' : 'shift_jisx0213',
diff --git a/Lib/encodings/big5.py b/Lib/encodings/big5.py
index 0f855f8..d56aa1b 100644
--- a/Lib/encodings/big5.py
+++ b/Lib/encodings/big5.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: big5.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_big5 import codec
-import codecs
+import _codecs_tw, codecs
+
+codec = _codecs_tw.getcodec('big5')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/big5hkscs.py b/Lib/encodings/big5hkscs.py
new file mode 100644
index 0000000..443997f
--- /dev/null
+++ b/Lib/encodings/big5hkscs.py
@@ -0,0 +1,34 @@
+#
+# big5hkscs.py: Python Unicode Codec for BIG5HKSCS
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+# $CJKCodecs: big5hkscs.py,v 1.1 2004/06/29 05:14:27 perky Exp $
+#
+
+import _codecs_hk, codecs
+
+codec = _codecs_hk.getcodec('big5hkscs')
+
+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
index 028832d..38937f5 100644
--- a/Lib/encodings/cp932.py
+++ b/Lib/encodings/cp932.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: cp932.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_cp932 import codec
-import codecs
+import _codecs_jp, codecs
+
+codec = _codecs_jp.getcodec('cp932')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/cp949.py b/Lib/encodings/cp949.py
index c499d20..0f3c847 100644
--- a/Lib/encodings/cp949.py
+++ b/Lib/encodings/cp949.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: cp949.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_cp949 import codec
-import codecs
+import _codecs_kr, codecs
+
+codec = _codecs_kr.getcodec('cp949')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/cp950.py b/Lib/encodings/cp950.py
index 104651d..dab3e28 100644
--- a/Lib/encodings/cp950.py
+++ b/Lib/encodings/cp950.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: cp950.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_cp950 import codec
-import codecs
+import _codecs_tw, codecs
+
+codec = _codecs_tw.getcodec('cp950')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/euc_jis_2004.py b/Lib/encodings/euc_jis_2004.py
new file mode 100644
index 0000000..02d55ca
--- /dev/null
+++ b/Lib/encodings/euc_jis_2004.py
@@ -0,0 +1,34 @@
+#
+# euc_jis_2004.py: Python Unicode Codec for EUC_JIS_2004
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+# $CJKCodecs: euc_jis_2004.py,v 1.1 2004/07/07 16:18:25 perky Exp $
+#
+
+import _codecs_jp, codecs
+
+codec = _codecs_jp.getcodec('euc_jis_2004')
+
+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
index 9da6b99..30f173e 100644
--- a/Lib/encodings/euc_jisx0213.py
+++ b/Lib/encodings/euc_jisx0213.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: euc_jisx0213.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_euc_jisx0213 import codec
-import codecs
+import _codecs_jp, codecs
+
+codec = _codecs_jp.getcodec('euc_jisx0213')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/euc_jp.py b/Lib/encodings/euc_jp.py
index 77fe2b6..a3947a3 100644
--- a/Lib/encodings/euc_jp.py
+++ b/Lib/encodings/euc_jp.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: euc_jp.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_euc_jp import codec
-import codecs
+import _codecs_jp, codecs
+
+codec = _codecs_jp.getcodec('euc_jp')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/euc_kr.py b/Lib/encodings/euc_kr.py
index 9ef155e..bbebee8 100644
--- a/Lib/encodings/euc_kr.py
+++ b/Lib/encodings/euc_kr.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: euc_kr.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_euc_kr import codec
-import codecs
+import _codecs_kr, codecs
+
+codec = _codecs_kr.getcodec('euc_kr')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/gb18030.py b/Lib/encodings/gb18030.py
index f628af3..7eca319 100644
--- a/Lib/encodings/gb18030.py
+++ b/Lib/encodings/gb18030.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: gb18030.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_gb18030 import codec
-import codecs
+import _codecs_cn, codecs
+
+codec = _codecs_cn.getcodec('gb18030')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/gb2312.py b/Lib/encodings/gb2312.py
index 7ced701..5130efa 100644
--- a/Lib/encodings/gb2312.py
+++ b/Lib/encodings/gb2312.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: gb2312.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_gb2312 import codec
-import codecs
+import _codecs_cn, codecs
+
+codec = _codecs_cn.getcodec('gb2312')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/gbk.py b/Lib/encodings/gbk.py
index f5e32e5..67854bc 100644
--- a/Lib/encodings/gbk.py
+++ b/Lib/encodings/gbk.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: gbk.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_gbk import codec
-import codecs
+import _codecs_cn, codecs
+
+codec = _codecs_cn.getcodec('gbk')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/hz.py b/Lib/encodings/hz.py
index 0278ce5..3940894 100644
--- a/Lib/encodings/hz.py
+++ b/Lib/encodings/hz.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: hz.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_hz import codec
-import codecs
+import _codecs_cn, codecs
+
+codec = _codecs_cn.getcodec('hz')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/iso2022_jp.py b/Lib/encodings/iso2022_jp.py
index a23a13a..109658b 100644
--- a/Lib/encodings/iso2022_jp.py
+++ b/Lib/encodings/iso2022_jp.py
@@ -1,12 +1,13 @@
#
-# iso2022_jp.py: Python Unicode Codec for ISO_2022_JP
+# iso2022_jp.py: Python Unicode Codec for ISO2022_JP
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
-# $CJKCodecs: iso2022_jp.py,v 1.3 2004/01/17 11:26:10 perky Exp $
+# $CJKCodecs: iso2022_jp.py,v 1.2 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_iso2022_jp import codec
-import codecs
+import _codecs_iso2022, codecs
+
+codec = _codecs_iso2022.getcodec('iso2022_jp')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/iso2022_jp_1.py b/Lib/encodings/iso2022_jp_1.py
index 6050e5f..201bd28 100644
--- a/Lib/encodings/iso2022_jp_1.py
+++ b/Lib/encodings/iso2022_jp_1.py
@@ -1,12 +1,13 @@
#
-# iso2022_jp_1.py: Python Unicode Codec for ISO_2022_JP_1
+# iso2022_jp_1.py: Python Unicode Codec for ISO2022_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 $
+# $CJKCodecs: iso2022_jp_1.py,v 1.2 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_iso2022_jp_1 import codec
-import codecs
+import _codecs_iso2022, codecs
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_1')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/iso2022_jp_2.py b/Lib/encodings/iso2022_jp_2.py
index 6171710..7a61018 100644
--- a/Lib/encodings/iso2022_jp_2.py
+++ b/Lib/encodings/iso2022_jp_2.py
@@ -1,12 +1,13 @@
#
-# iso2022_jp_2.py: Python Unicode Codec for ISO_2022_JP_2
+# iso2022_jp_2.py: Python Unicode Codec for ISO2022_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 $
+# $CJKCodecs: iso2022_jp_2.py,v 1.2 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_iso2022_jp_2 import codec
-import codecs
+import _codecs_iso2022, codecs
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_2')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/iso2022_jp_2004.py b/Lib/encodings/iso2022_jp_2004.py
new file mode 100644
index 0000000..2497124
--- /dev/null
+++ b/Lib/encodings/iso2022_jp_2004.py
@@ -0,0 +1,34 @@
+#
+# iso2022_jp_2004.py: Python Unicode Codec for ISO2022_JP_2004
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+# $CJKCodecs: iso2022_jp_2004.py,v 1.1 2004/07/07 16:18:25 perky Exp $
+#
+
+import _codecs_iso2022, codecs
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_2004')
+
+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
index 144f83e..8b2ed00 100644
--- a/Lib/encodings/iso2022_jp_3.py
+++ b/Lib/encodings/iso2022_jp_3.py
@@ -1,12 +1,13 @@
#
-# iso2022_jp_3.py: Python Unicode Codec for ISO_2022_JP_3
+# iso2022_jp_3.py: Python Unicode Codec for ISO2022_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 $
+# $CJKCodecs: iso2022_jp_3.py,v 1.2 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_iso2022_jp_3 import codec
-import codecs
+import _codecs_iso2022, codecs
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_3')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/iso2022_jp_ext.py b/Lib/encodings/iso2022_jp_ext.py
index 7adf758..97cb4e7 100644
--- a/Lib/encodings/iso2022_jp_ext.py
+++ b/Lib/encodings/iso2022_jp_ext.py
@@ -1,12 +1,13 @@
#
-# iso2022_jp_ext.py: Python Unicode Codec for ISO_2022_JP_EXT
+# iso2022_jp_ext.py: Python Unicode Codec for ISO2022_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 $
+# $CJKCodecs: iso2022_jp_ext.py,v 1.2 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_iso2022_jp_ext import codec
-import codecs
+import _codecs_iso2022, codecs
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_ext')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/iso2022_kr.py b/Lib/encodings/iso2022_kr.py
index ead7ff5..f5549ca 100644
--- a/Lib/encodings/iso2022_kr.py
+++ b/Lib/encodings/iso2022_kr.py
@@ -1,12 +1,13 @@
#
-# iso2022_kr.py: Python Unicode Codec for ISO_2022_KR
+# iso2022_kr.py: Python Unicode Codec for ISO2022_KR
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
-# $CJKCodecs: iso2022_kr.py,v 1.3 2004/01/17 11:26:10 perky Exp $
+# $CJKCodecs: iso2022_kr.py,v 1.2 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_iso2022_kr import codec
-import codecs
+import _codecs_iso2022, codecs
+
+codec = _codecs_iso2022.getcodec('iso2022_kr')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/johab.py b/Lib/encodings/johab.py
index 720195e..b6a87d7 100644
--- a/Lib/encodings/johab.py
+++ b/Lib/encodings/johab.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: johab.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_johab import codec
-import codecs
+import _codecs_kr, codecs
+
+codec = _codecs_kr.getcodec('johab')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/shift_jis.py b/Lib/encodings/shift_jis.py
index d235c1e..ec5e517 100644
--- a/Lib/encodings/shift_jis.py
+++ b/Lib/encodings/shift_jis.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: shift_jis.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_shift_jis import codec
-import codecs
+import _codecs_jp, codecs
+
+codec = _codecs_jp.getcodec('shift_jis')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)
diff --git a/Lib/encodings/shift_jis_2004.py b/Lib/encodings/shift_jis_2004.py
new file mode 100644
index 0000000..446cd7c
--- /dev/null
+++ b/Lib/encodings/shift_jis_2004.py
@@ -0,0 +1,34 @@
+#
+# shift_jis_2004.py: Python Unicode Codec for SHIFT_JIS_2004
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+# $CJKCodecs: shift_jis_2004.py,v 1.1 2004/07/07 16:18:25 perky Exp $
+#
+
+import _codecs_jp, codecs
+
+codec = _codecs_jp.getcodec('shift_jis_2004')
+
+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
index 8759c8c..495468b 100644
--- a/Lib/encodings/shift_jisx0213.py
+++ b/Lib/encodings/shift_jisx0213.py
@@ -2,11 +2,12 @@
# 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 $
+# $CJKCodecs: shift_jisx0213.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#
-from _codecs_shift_jisx0213 import codec
-import codecs
+import _codecs_jp, codecs
+
+codec = _codecs_jp.getcodec('shift_jisx0213')
class Codec(codecs.Codec):
encode = codec.encode
@@ -30,4 +31,4 @@ class StreamWriter(Codec, codecs.StreamWriter):
self.reset = __codec.reset
def getregentry():
- return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+ return (codec.encode, codec.decode, StreamReader, StreamWriter)