In Ruby, you can find the encoding used like this:
Announcement
You can find all my latest posts on medium.irb(main):005:0* puts "abc".encoding UTF-8 => nil irb(main):006:0>
You can change this by writing the follow special comment:
irb(main):005:0* puts "abc".encoding UTF-8 => nil irb(main):006:0> irb(main):002:0> # encoding: us-ascii irb(main):003:0* puts "abc".encoding US-ASCII => nil
In a ruby script, this encoding command has to appear on the first line of the file, or the second line, if the first line is a she-bang line, e.g.:
#!/usr/bin/ruby # encoding: UTF-8 . . .