Bali Bali wrote: > Below code: > -- > s1 = "good" > > File.new("test.xml", "w+") << s1 > -- > > It always give a file ANSI encoded. How can I get it UTF-8 encoded? What do you mean by "ANSI encoded"? Do you mean "ASCII"? The text "good" is exactly the same in both ASCII and UTF-8, so how do you know it is one and not the other? Can you give a different example which shows the problem? Use "hexdump -C test.xml" to show the exact content of the file, byte by byte. -- Posted via http://www.ruby-forum.com/.