How to save file in different Encoding?

hi, i try to save blow file in different Encoding . how can i do this? :thinking: :heartpulse:"c:/ruby/hps.txt","w")
file.puts 'there is some text'

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 ="c:/ruby/hps.txt","w:UTF-8:UTF-8")

For more information on string and file encoding, see the Encoding class introduction.

1 Like

wow tank you amazing @DanRathbun