This is a best practice. On one hand the interpreter is told the default internal encoding upfront and so any builtin strings have that one set. On the other hand we do not mess with the default external character encoding, which is going to have a sensible default taken from $LANG or whatever. The external encoding is not the business of the script, it is rather a choice made by the user we have to honor. Note that even if ruby is invoked by hand (rather than implicitly via the +x flag), the -U flag is still picked by the interpreter from the shebang.