From: Louise Rains Date: 2008-10-27T20:12:15+09:00 Subject: Re: Iconv problem - not handling \r correctly It looks like IO.binmode does the same thing as well: file = File.new("sta_utf16.xml", "wb") file.binmode file.write(result) file.close Thanks! > Heesob Park wrote: > No, it's a defect not in Iconv but in Windows. > > Use binary flag for file handling like this: > > file = File.open("sta_utf8.xml","rb").read > conv = Iconv.new("UTF-16LE", "UTF-8") > result = conv.iconv(file); > result= 0xFF.chr << 0xFE.chr << result > file = File.new("sta_utf16.xml", "wb") > file.write(result) > file.close > > > Regards, > > Park Heesob -- Posted via http://www.ruby-forum.com/.