hi, i try to save blow file in different Encoding . how can i do this?
![]()
file=File.new("c:/ruby/hps.txt","w")
file.puts 'there is some text'
file.close
hi, i try to save blow file in different Encoding . how can i do this?
![]()
file=File.new("c:/ruby/hps.txt","w")
file.puts 'there is some text'
file.close
The File class is a subclass of the IO class, so look at the IO::new constructor documentation.
It explains that the mode string can also specify the external and internal encoding.
Ie …
file = File.new("c:/ruby/hps.txt","w:UTF-8:UTF-8")
For more information on string and file encoding, see the Encoding class introduction.
wow tank you amazing @DanRathbun