I'm trying to create a gem that wraps d3.js, Source can be found at https://github.com/iblue/d3-rails
So, when I include this stone in my gemfile
gem "d3-rails", :git => "git://github.com/iblue/d3-rails.git"
And when I include javascript in my application.js:
//=require d3
Then my merge compilation failed, and my compiled application.js just contain
throw Error("Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT")
I am using Rails 3.1.3 and ruby-1.9.3-p125. jQuery uses exactly the same gem structure and it works. What am I doing wrong?
EDIT
I also saw this question: Ruby 1.9 throwing javascript coding error . This is not applicable here, my file is valid UTF-8:
ruby-1.9.3-p125 :001 > d = File.read("./d3.js") => [...] ruby-1.9.3-p125 :002 > d.encoding =>
EDIT 2 :
I also tried to insert some voodoo into my config/environment.rb . This does not work:
# -*- encoding : utf-8 -*-
iblue
source share