Ruby: how to add “# encoding: UTF-8” automatically? January 2, 2024 by Tarik Upgrade to Ruby 2.0, as it makes UTF-8 the default encoding, removing the need for magic comments.