Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid byte sequence in US-ASCII : report the wrongly encoded file #12041

Closed
augnustin opened this issue Aug 27, 2013 · 9 comments
Closed

invalid byte sequence in US-ASCII : report the wrongly encoded file #12041

augnustin opened this issue Aug 27, 2013 · 9 comments

Comments

@augnustin
Copy link

It took me hours to solve this error:

ArgumentError in HomeController#index
invalid byte sequence in US-ASCII

having no other information about where the error came from.

Can't ruby/rails report the filename when this issue arises?
(In my case, it was in one of the application helpers ...)
Or am I lacking of experience in Rails to debug this super quickly?

@pftg
Copy link
Contributor

pftg commented Aug 27, 2013

I think you use ruby 1.9.3. Please try to add # encoding: UTF-8 at the top of the file.

@augnustin
Copy link
Author

Thanks for such quick reply.

Yes I use Ruby 1.9.3 and Rails 3.2

I actually fixed it already (I should have mentionned it in the . Here is the stackoverflow post refering the problem : http://stackoverflow.com/questions/18467786/rails-invalid-byte-sequence-in-us-ascii

But what I'm reporting here is that the error message should be more verbose, and mentionning the error's filename or even better line number.

What do you reckon ?

@rafaelfranca
Copy link
Member

This is not a Rails error message, it is Ruby that is giving you this error. If you want a more verbose error message you should file a Ruby issue.

@augnustin
Copy link
Author

Yup, ok thanks!

@rafaelfranca
Copy link
Member

One question. If you have the application stopped and run the rails server will the application boot?

@augnustin
Copy link
Author

Yes, it does boot.
Public files and assets are served.
But whichever controller called and it fails.

2013/8/27 Rafael Mendonça França notifications@github.com

One question. If you have the application stopped and run the rails server
will the application boot?


Reply to this email directly or view it on GitHubhttps://github.com//issues/12041#issuecomment-23350183
.

@rafaelfranca
Copy link
Member

I see. If you try to boot the application in the production environment of even on the test environment I think it will not boot and maybe it will give you a better error message.

@augnustin
Copy link
Author

Indeed :

/home/augustin/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
`require': /home/augustin/Workspace/copass/app/helpers/groups_helper.rb:7:
invalid multibyte char (US-ASCII) (SyntaxError)
/home/augustin/Workspace/copass/app/helpers/groups_helper.rb:7: invalid
multibyte char (US-ASCII)
/home/augustin/Workspace/copass/app/helpers/groups_helper.rb:7: syntax
error, unexpected $end, expecting keyword_end
      haml_tag "€"

But who could dare trying in production what doesn't work in development?

@rafaelfranca
Copy link
Member

In test you will get the same result, or even in development if you enable the eager loading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants