diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-05-28 15:54:13 -0500 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-05-28 17:12:48 -0500 |
commit | cf3ccd7be0caae67dfddf5bc5056dcfdaab6f369 (patch) | |
tree | 0eb00c04bf85a5b71738888230c1f4fdbf286a3e | |
parent | 4e50a35fa243f6cf7ad567774a9f7c1cb87a1653 (diff) | |
download | rails-cf3ccd7be0caae67dfddf5bc5056dcfdaab6f369.tar.gz rails-cf3ccd7be0caae67dfddf5bc5056dcfdaab6f369.tar.bz2 rails-cf3ccd7be0caae67dfddf5bc5056dcfdaab6f369.zip |
Ruby 1.9: use UTF-8 for default internal and external encodings.
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/lib/initializer.rb | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 8e7dfb38cc..782afd5aa4 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *Edge* +* Ruby 1.9: use UTF-8 for default internal and external encodings. [Jeremy Kemper] + * Added db/seeds.rb as a default file for storing seed data for the database. Can be loaded with rake db:seed (or created alongside the db with db:setup). (This is also known as the "Stop Putting Gawd Damn Seed Data In Your Migrations" feature) [DHH] diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 7ae766f913..bbaa313fae 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -426,10 +426,14 @@ Run `rake gems:install` to install the missing gems. # should override this behaviour and set the relevant +default_charset+ # on ActionController::Base. # - # For Ruby 1.9, this does nothing. Specify the default encoding in the Ruby - # shebang line if you don't want UTF-8. + # For Ruby 1.9, UTF-8 is the default internal and external encoding. def initialize_encoding - $KCODE='u' if RUBY_VERSION < '1.9' + if RUBY_VERSION < '1.9' + $KCODE='u' + else + Encoding.default_internal = Encoding::UTF_8 + Encoding.default_external = Encoding::UTF_8 + end end # This initialization routine does nothing unless <tt>:active_record</tt> |