How to reproduce
Gemfile
gem 'haml'
gem 'sass'
gem 'coffee-script'
app/app.rb
get '/javascripts/rus_test.js' do
content_type 'text/javascript', charset: 'utf-8'
coffee :"../../public/javascripts/rus_test"
end
public/javascripts/rus_test.coffee (it's work)
alert 'Hello World!'
localhost:3000/javascripts/rus_test.js
(function() {
alert('Hello World!');
}).call(this);
public/javascripts/rus_test.coffee (doesn't work)
alert 'Привет!'
GIVES ERROR
Encoding::UndefinedConversionError at /javascripts/rus_test.js "\xD0" from ASCII-8BIT to UTF-8
I tried to set several variants of Encoding.default in config/boot.rb.
one of variants of boot initializing
Padrino.before_load do
Encoding.default_internal = nil
# Encoding.default_external = 'ASCII-8BIT'
end
It's work for HAML with russian text, but doesn't work for SASS and COFFEE
What should I do to fix it?