perky 03/01/12 15:01:35
Modified: korean iso_2022_kr.py
Log:
Style fix: Use global constant, remove useless comments.
Revision Changes Path
1.6 +6 -5 KoreanCodecs/korean/iso_2022_kr.py
Index: iso_2022_kr.py
===================================================================
RCS file: /cvsroot/koco/KoreanCodecs/korean/iso_2022_kr.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- iso_2022_kr.py 12 Jan 2003 22:54:12 -0000 1.5
+++ iso_2022_kr.py 12 Jan 2003 23:01:34 -0000 1.6
@@ -17,7 +17,7 @@
# along with KoreanCodecs; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# $Id: iso_2022_kr.py,v 1.5 2003/01/12 22:54:12 perky Exp $
+# $Id: iso_2022_kr.py,v 1.6 2003/01/12 23:01:34 perky Exp $
#
import codecs
@@ -48,10 +48,12 @@
def encode(self, data, errors='strict'):
if errors not in ('strict', 'ignore', 'replace'):
raise ValueError, "unknown error handling"
+
buffer = []
designation = [US_ASCII, US_ASCII]
new_designation = designation[:]
new_shiftstate = shiftstate = 0
+
for c in data:
if c in ('\n', '\r'):
new_shiftstate = 0
@@ -63,7 +65,7 @@
else:
new_shiftstate = 1
new_designation[1] = KSC5601_1987
- s = c.encode('korean.euc_kr', errors)
+ s = c.encode(KSC5601_CODEC, errors)
if designation[0] != new_designation[0]:
buffer.append(DESIGNATION_MARK[(G0, new_designation[0])])
@@ -144,15 +146,14 @@
return (u''.join(buffer), len(data))
+
class StreamWriter(Codec, codecs.StreamWriter):
pass
+
class StreamReader(Codec, codecs.StreamReader):
pass
- # not implemented.
- # (JapaneseCodecs's implementation is so different to adopt.)
-### encodings module API
def getregentry():
return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
|