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
  • 41,184
  • 82
  • 214
  • 317

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
  • 353,842
  • 52
  • 662
  • 667
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
  • 28,632
  • 7
  • 39
  • 49