encoding latin1 to utf-8

2007-09-10 Thread Harshad Modi
hello ,
 I make one function for encoding latin1 to utf-8. but i think it is
not work proper.
plz guide me.

it is not get proper result . such that i got "Belgi�" using this
method, (Belgium)  :

import codecs
import sys
# Encoding / decoding functions
def encode(filename):
 file = codecs.open(filename, encoding="latin-1")
 data = file.read()
 file = codecs.open(filename,"wb", encoding="utf-8")
 file.write(data)

file_name=sys.argv[1]
encode(file_name)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: encoding latin1 to utf-8

2007-09-10 Thread Harshad Modi
thx for Reply ,
but I need some basic knowledge . how to encoding ? which algorithm
use for that . bz my data has some special char , i have not
confidence   this function got proper result. i want to make my own
function  / script for encoding.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: encoding latin1 to utf-8

2007-09-12 Thread Harshad Modi
thx for response ,
i think, my file has wrong encoding format.
thanks for guide and advise

-- 
http://mail.python.org/mailman/listinfo/python-list