Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails/Ruby 1.9: Is there a better way to put Unicode in source files than sticking # encoding at the top of every file

I just upgraded to Rails 3 and Ruby 1.9. All of my source files that used Unicode inside of them (such as emdashes) caused problems until I found out that you now need to include the following magic comment on top of each source file:

# encoding: utf-8

Is there a better way to do this? It'd be nice if it just automatically treated every source file as utf-8 like Rails 2.3/Ruby 1.8 did, and I don't see any apparent disadvantage from doing so.

In my application.rb I already have the following, but I can't tell that it does anything:

config.encoding = "utf-8"
like image 407
William Jones Avatar asked Dec 18 '10 19:12

William Jones


1 Answers

i found only rake check_encoding_headers it add the magic comment to all files.

like image 196
codevoice Avatar answered Sep 20 '22 14:09

codevoice