>>>>> Harshad Modi <[EMAIL PROTECTED]> (HM) wrote: >HM> hello , >HM> I make one function for encoding latin1 to utf-8. but i think it is >HM> not work proper. >HM> plz guide me.
>HM> it is not get proper result . such that i got "Belgi�" using this >HM> method, (Belgium) : >HM> import codecs >HM> import sys >HM> # Encoding / decoding functions >HM> def encode(filename): >HM> file = codecs.open(filename, encoding="latin-1") >HM> data = file.read() >HM> file = codecs.open(filename,"wb", encoding="utf-8") >HM> file.write(data) >HM> file_name=sys.argv[1] >HM> encode(file_name) I tried this program and for me it works correctly. So you probably used a wrong input file or you misinterpreted the output. To be sure make hex dumps of your input/output. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list