Monday, October 19, 2009

Writing Unicode file in Python

Just use the following code to write an Unicode text in a file by Python.
out = file("Unicode-File.txt", "w" )
out.write(codecs.BOM_UTF8)
s = "any Unicode text"
out.write( s.encode( "utf-8" ) )

No comments: