generated gzip files has a invalid UTF-8 byte sequence #219

dbarison opened this Issue Oct 7, 2011 · 4 comments


None yet

2 participants

dbarison commented Oct 7, 2011
~/Code/maxima (master ✘)✹ ᐅ RAILS_ENV=production rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
/Users/davide/Code/maxima/public/assets/admin/autoload/jquery.jcrop-da53044b4354457d481377803404c7cc.css.gz has  a invalid UTF-8 byte sequence

 Tasks: TOP => assets:precompile
 (See full trace by running task with --trace)

I'm useing this gems:

gem 'rails', '3.1.0'
gem 'sprockets', :git => '', :branch => '2.1.x'
gem 'execjs', :git => 'git://'

All source files js,css are UTF-8 valid.

josh commented Oct 7, 2011

Well, it looks like you are trying to concatenate jquery.jcrop-da53044b4354457d481377803404c7cc.css.gz into your javascript bundle. GZ is binary and is not UTF-8 hence the error.

@josh josh closed this Oct 7, 2011
dbarison commented Oct 7, 2011

i don't concatenate any gzip binary

some information:

config.assets.precompile += %w( admin.js admin.css print.css admin_print.css ie.css admin_ie.css )


//= require admin/sass/import
//= require_tree ./admin/autoload

autoload directory contains
jquery.jcrop.scss and jquery.ui.scss

if i remove these files i got this error ->

with sprockets 2.0.0 works but with the static_root bug (only first time i do rake assets:precompile)

undefined method `static_root' for #<Sprockets::Index:0x00000002cf1500>

Second time is ok

josh commented Oct 7, 2011
//= require_tree ./admin/autoload

Is pulling in jquery.jcrop-da53044b4354457d481377803404c7cc.css.gz. Move that gz file elsewhere or don't use require_tree.

dbarison commented Oct 7, 2011

Thank you, found the problem

When i inspected config.assets.precompile
i got [/\w+\.(?!js|css).+/, /application.(css|js)$/]

The first regular expression allow .gz after js or css files that cause the utf error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment