What is your locale in the shell? On Linux-based systems, you can verify this by running the command localeand changing it, for example.
$ export LANG=en_US
I assume that you are using the locale settings that encode UTF-8, and this leads Ruby to assume that the text files were created according to utf-8 encoding rules. You can see it by trying
$ LANG=en_GB ruby -e 'warn "foo".encoding.name'
US-ASCII
$ LANG=en_GB.UTF-8 ruby -e 'warn "foo".encoding.name'
UTF-8
For a more general discussion of how string coding has changed in Ruby 1.9, I highly recommend
http://blog.grayproductions.net/articles/ruby_19s_string
(code examples assume that bash or similar shells - derivatives of C shells are different)
source
share