From: Bali Bali Date: 2009-07-30T13:11:43+09:00 Subject: Re: How to save string to a file as UTF-8 pierr wrote: > Bali Bali wrote: >> > If your ruby version < "1.9" > $KCODE = "UTF8" > else > #!/usr/bin/env ruby > # encoding: utf-8 <--- this line > end > > (NOTES : above code is not legal ruby code) pierr, Thanks! But looks like it is not working for me. Code v2.0 -- $KCODE = "UTF-8" s1 = "good" File.new("test.xml", "w+") << s1 -- It still creates a ANSI file. My Ruby version: ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] It is windows release which should not be related to the issue. Any idea? -- Posted via http://www.ruby-forum.com/.