documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.com/jammit/
MIT License
1.16k stars 197 forks source link

Encoding issue with ruby 1.9.2 #94

Closed larskuhnt closed 13 years ago

larskuhnt commented 13 years ago

Hi, I got the following error when I tried to compress assets with non ascii chars:

/usr/local/rvm/gems/ruby-1.9.2-p0/gems/jammit-0.5.4/lib/jammit/compressor.rb:153:in `gsub': invalid byte sequence in US-ASCII (ArgumentError)

I fixed the problem by forcing the BINARY encoding on the compressed data. Maybe you can take a look at the patch.

Thanks and keep up the good work Lars

jashkenas commented 13 years ago

I'd love to get this fixed, but the files should already be read in binary format:

https://github.com/documentcloud/jammit/blob/master/lib/jammit/compressor.rb#L245-249

I believe this needs to be patched in the yui-compressor gem, which is probably reading back in the compressed CSS in ASCII mode, after shelling out to Java. I'm sure sstephenson would be glad to take a patch that addresses it.