lundi 25 avril 2016

assets:precompile: uglify.js failed to open due to invalid conversion sequence from utf-8 to shift_jis

This is a weird problem.

My config.encoding is set to shift_jis (so all database/excel etc will be read in as shift_jis by default).

When I execue (windows environment)

> rake assets:precompile RAILS_ENV="production"

There's such error:

rake aborted!
Encoding::UndefinedConversionError: U+00A0 from UTF-8 to Shift_JIS
C:/Ruby22/lib/ruby/gems/2.2.0/gems/uglifier-3.0.0/lib/uglifier.rb:156:in `read'
C:/Ruby22/lib/ruby/gems/2.2.0/gems/uglifier-3.0.0/lib/uglifier.rb:156:in `open'

The line 156 of uglifier.rb is:

  File.open(file, "r:UTF-8", &:read)

Initially I thought it's because of my own css or js file that causes problem, I then tried to convert all my js/css files to utf-8/shift_jis and there's no use.

I then try to print out the file name, I found that the one that causes this error is uglifier.js.

However, uglifier.js has no Japanese characters, why opening uglfier.js will cause

Encoding::UndefinedConversionError: U+00A0 from UTF-8 to Shift_JIS

?

Can anyone help?

Thank you very much.

Aucun commentaire:

Enregistrer un commentaire