[ Index ] |
|
Code source de Kupu-1.3.5 |
1 #!/usr/bin/env python 2 3 import sys 4 5 def convert(data, encoding='ISO-8859-1'): 6 data = unicode(data, encoding) 7 data = data.encode('UTF-8') 8 return data 9 10 if __name__ == '__main__': 11 if len(sys.argv) < 3: 12 print 'Usage: %s <inputfile> <outputfile> [<encoding>]' 13 infilename = sys.argv[1] 14 outfilename = sys.argv[2] 15 encoding = 'ISO-8859-1' 16 if len(sys.argv) > 3: 17 encoding = sys.argv[3] 18 fpi = open(infilename) 19 try: 20 data = fpi.read() 21 finally: 22 fpi.close() 23 utfdata = convert(data, encoding) 24 fpo = open(outfilename, 'wb') 25 try: 26 fpo.write(utfdata) 27 finally: 28 fpo.close()
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:30:41 2007 | par Balluche grâce à PHPXref 0.7 |