This project is archived and is in readonly mode.
Add magic encoding comment to generated files
Reported by fakingfantastic | June 21st, 2010 @ 06:55 PM
Real easy to make this one happen.
- Boot a new Rails 3b4 app on 1.9.2
- Make a static controller
- in static#index, print out a helper function
- make the helper method spit out "»"
- Load the page and wait for the excitement
A nicer person would just attach the app to this ticket, so I did.
I'm looking to whip up a test case or a patch, but I'm a little over my head, maybe a better-equipped person can help out while I keep digging.
I just want to be accepted, that's all...
Comments and changes to this ticket
-
Aaron Patterson June 22nd, 2010 @ 05:00 PM
- Assigned user set to Aaron Patterson
-
Bruno Michel June 29th, 2010 @ 10:21 PM
- Importance changed from to Low
You can add a comment in app/helpers/application_helper.rb to make it works:
# encoding: utf-8
It says to ruby-1.9.2 that strings in this particular file should be considered as encoded in 'utf-8' (and not 'ascii', the default value).
-
Aditya Sanghi October 7th, 2010 @ 05:54 PM
I recently saw a patch that would automatically put the encoding in some generated files in Ruby > 1.9. Do you think a patch would be good to extend this in other files generated by Rails, such as the layout, application_helper.rb etc?
@fakingfantastic, I too confirm that adding the line as @bruno suggests solves the problem.
-
Aditya Sanghi October 7th, 2010 @ 05:58 PM
@fakingfantastic one more thing, i actually bothered to open your zip file and have a look just now. You cant just put » in your helper WITHOUT quotes.
That's just wrong, no? I mean » is not a variable or a method, if you want it treated like a string you need to quote it.
-
David Trasbo October 7th, 2010 @ 08:36 PM
- State changed from new to invalid
Aditya is right. In order to make this work you do need the quotes and setting the encoding at the top of the file. As long as you don't specify the encoding, though, quotes or no quotes, the error will always be there.
Marking this invalid.
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>