ndbroadbent / turbo-sprockets-rails3

Speeds up your Rails 3 assets:precompile by only recompiling changed files, and only compiling once to generate all assets
MIT License
976 stars 78 forks source link

fix 'invalid byte sequence in UTF-8' error #74

Closed tooooolong closed 10 years ago

ruuts commented 10 years ago

@tooooolong Nice inspiration http://robots.thoughtbot.com/post/42664369166/fight-back-utf-8-invalid-byte-sequences. Just applied the same method, at least assets are compiling.

tooooolong commented 10 years ago

I will fix the error to fit ruby 1.8.7

tooooolong commented 10 years ago

Could you please upload a new version gem to Rubygems after you merge this.

ndbroadbent commented 10 years ago

Hi, unfortunately this is the incorrect way to solve the problem. Please see the discussion on #35

ndbroadbent commented 10 years ago

I might make the Uglifier configuration automatic in the next version:

# override default uglifier options so we don't mangle unicode
  config.assets.js_compressor = Uglifier.new(output: {ascii_only: true})

The issue should be solved if you put that in your application.rb

tooooolong commented 10 years ago

I'll try it. Thank you.

tooooolong commented 10 years ago

It solved my problem, thank you.

tooooolong commented 10 years ago

when i run asset precompile on my machine, it works

but i still get the UTF-8 error when i deploy code to production machine. and can fixed by this PR

warp commented 10 years ago

@tooooolong try deleting the compiled assets from your production machine the fix should work for subsequent runs of rake assets:precompile again

GarPit commented 10 years ago

Uglifier fix not working for me. Same issue - UTF-8 error

davidguthu commented 10 years ago

I'm seeing the same issue.. I traced it to a line in a comment in one of the included javascript files in a gem we added. .

The line is commented

If I remove that line then the compilation doesn't blow up. I'm not sure why a comment is hanging it up, or .. really how to fix this..