#!/usr/bin/env python
#-*- coding: cp936 -*-
import codecs
import sys
if __name__ == '__main__':
if len(sys.argv) != 5:
print 'python %s inFile decodeType outFile encodeType' % sys.argv[0]
sys.exit(1)
fin = codecs.open(sys.argv[1],'r',sys.argv[2])
fout = codecs.open(sys.argv[3],'w',sys.argv[4])
fout.write(''.join(fin.readlines()))
str = '中国人'
coco = codecs.lookup('gbk')
b = coco.decode(str)
print b[1],b[0],type(b[0])
b2 = coco.encode(b[0])
print b2[1],b2[0],type(b2[0])