Permalink
Browse files

use -U rather than encoding assignments

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.
  • Loading branch information...
1 parent 3dde315 commit 02dbf78d6bccb143b77dfea7a600f9c4dbb3c087 @fxn committed Sep 11, 2012
Showing with 1 addition and 5 deletions.
  1. +1 −5 bin/tkn
View
6 bin/tkn
@@ -1,10 +1,6 @@
-#!/usr/bin/env ruby
+#!/usr/bin/env ruby -U
# encoding: utf-8
-# UTF-8 ALL THE THINGS.
-Encoding.default_external = 'utf-8'
-Encoding.default_internal = 'utf-8'
-
require 'io/console'
require 'active_support/core_ext/string/strip'
require 'pygments'

0 comments on commit 02dbf78

Please sign in to comment.