From: "Sebastjan H." Date: 2012-05-18T19:55:55+09:00 Subject: Re: reading from and writing to a Unicode encoded file Regis d'Aubarede wrote in post #1061272: > Hello, > tested on windows: > > open("data.txt", "rb:UTF-16LE") {|fin| > open("odata.txt", "wb:UTF-8") { |fout| > fout.write(fin.read()) > } > } > > Regards, thx, it works for me too, however, I wanted to include it in the script refered to above, so I tried this modification according to your modell: -------------------------------------- file = ARGV[0] File.open(file, "Unicode") {|fin| File.open(file, "wb:UTF-8") { |fout| fout.write(fin.read()) } } -------------------------------------- and I get an error. If possible, I want to run this file conversion prior to my other code, but the file should be named the same and the content untouched. I know that my version above would overwrite it. Something like this: 1. Convert the file. 2. Reopen the file. 3. Read the content. 4. Run some code on the content. 5. Write something back to the file. No. 1 is giving me the headache, the rest is in place:) regards, seba -- Posted via http://www.ruby-forum.com/.