cp949.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #
  2. # cp949.py: Python Unicode Codec for CP949
  3. #
  4. # Written by Hye-Shik Chang <[email protected]>
  5. # $CJKCodecs: cp949.py,v 1.8 2004/06/28 18:16:03 perky Exp $
  6. #
  7. import _codecs_kr, codecs
  8. codec = _codecs_kr.getcodec('cp949')
  9. class Codec(codecs.Codec):
  10. encode = codec.encode
  11. decode = codec.decode
  12. class StreamReader(Codec, codecs.StreamReader):
  13. def __init__(self, stream, errors='strict'):
  14. codecs.StreamReader.__init__(self, stream, errors)
  15. __codec = codec.StreamReader(stream, errors)
  16. self.read = __codec.read
  17. self.readline = __codec.readline
  18. self.readlines = __codec.readlines
  19. self.reset = __codec.reset
  20. class StreamWriter(Codec, codecs.StreamWriter):
  21. def __init__(self, stream, errors='strict'):
  22. codecs.StreamWriter.__init__(self, stream, errors)
  23. __codec = codec.StreamWriter(stream, errors)
  24. self.write = __codec.write
  25. self.writelines = __codec.writelines
  26. self.reset = __codec.reset
  27. def getregentry():
  28. return (codec.encode, codec.decode, StreamReader, StreamWriter)