Sha256: 59dfb8fb56d64572a4aea093c67209db30ddd8b850223dd15f872beb7c8ec62e

Contents?: true

Size: 380 Bytes

Versions: 2

Compression:

Stored size: 380 Bytes

Contents

require 'premailer/adapter/nokogiri'

Premailer::Adapter::Nokogiri.module_eval do
  # Patch load_html method to fix character encoding issues.
  def load_html(html)
    if RUBY_VERSION.to_f >= 1.9
      html = html.force_encoding('UTF-8').encode!
      ::Nokogiri::HTML(html) {|c| c.recover }
    else
      ::Nokogiri::HTML(html, nil, 'UTF-8') {|c| c.recover }
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
premailer-rails3-1.3.2 lib/premailer/rails/nokogiri_fix.rb
premailer-rails-1.3.2 lib/premailer/rails/nokogiri_fix.rb