Install and execute:
$ [sudo] gem install magic-commenter $ magic-commenter
It will iterate through all your .rb files and add utf8 magic comment if the paring fails with a multibyte error.