This project is archived and is in readonly mode.
Add magic encoding comment to generated files
Reported by ahe | February 18th, 2010 @ 03:02 PM
Hi,
In a brand new Rails 3.0.0.beta application, I created the following controller :
class TestController < ApplicationController
def index
@test = "héhé"
end
end
But I get the following error when I try to access it :
/Users/antho/workspace/bugchar/app/controllers/test_controller.rb:4: invalid multibyte char (US-ASCII)
/Users/antho/workspace/bugchar/app/controllers/test_controller.rb:4: invalid multibyte char (US-ASCII)
/Users/antho/workspace/bugchar/app/controllers/test_controller.rb:4: syntax error, unexpected $end, expecting keyword_end
@test = "héhé"
ruby 1.9.1p243 (2009-07-16 revision 24175)
[i386-darwin9.8.0]
Rails 3.0.0.beta
Any ideas?
Thanks,
Anthony
Comments and changes to this ticket
-
Norman Clarke April 8th, 2010 @ 03:57 AM
You probably need to add an encoding comment to the top of the file. For example:
# encoding: utf-8
-
Norman Clarke April 13th, 2010 @ 01:26 PM
- Tag changed from rails3 to invalid, rails3
-
Ryan Bigg April 14th, 2010 @ 04:24 AM
- Tag changed from invalid, rails3 to 3.0
Please do not go around marking tickets as invalid without confirmation from the OP that it fixes the problem or someone verifies it clearly.
-
Jeremy Kemper April 14th, 2010 @ 05:08 AM
- State changed from new to invalid
Good case for marking invalid, actually :) This will be a common Ruby issue. You have to state your source encoding if you use non US-ASCII chars in your string literals, regexps, method names, etc.
-
M-Ryan August 3rd, 2010 @ 01:55 PM
- Importance changed from to Low
I created a small tool to set magic comments on large number of source files quickly.
It's called magic_encoding, it's still very early in development but it's already functionnal (gem install magic_encoding)Source : http://github.com/m-ryan/magic_encoding)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>