1

I have a rails application and i keep getting this error

  /srv/projects/app/controllers/application_controller.rb:174: invalid multibyte char (US-ASCII) /srv/projects/app/controllers/application_controller.rb:174: invalid multibyte char (US-ASCII) /srv/projects/app/controllers/application_controller.rb:174: syntax error, unexpected $end, expecting ')' ...e_title = h("#{project_name} — #{name || translate_locatio... ... ^

and the fix should be here but when i added the line on top of my application controller i still get the error...i even restarted apache

Here is my application controller

# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

# encoding: utf-8


class ApplicationController < ActionController::Base
# encoding: utf-8
Community
  • 1
  • 1
Matt Elhotiby
  • 43,028
  • 85
  • 218
  • 321

2 Answers2

2

The encoding comment must be on top of the file before anything else - including other comments (except the shebang if you have one).

sepp2k
  • 363,768
  • 54
  • 674
  • 675
1

Your class should look like this:

# encoding: utf-8
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base

(with the magic comment at the top)

bbonamin
  • 30,042
  • 7
  • 40
  • 49