Sha256: 0e1ee55f55fa07fd641e8b247c98dfbaf1f60a16e8a7331c22d3afff336d9a51

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

require 'premailer/adapter/nokogiri'

Premailer::Adapter::Nokogiri.module_eval do
  # Patch load_html method to fix character encoding issues.
  # Assume that actionmailer_inline_css will always be loading html from a UTF-8 string.
  def load_html(html)
    # Force UTF-8 encoding
    if RUBY_VERSION =~ /1.9/
      doc = ::Nokogiri::HTML(html.encode('UTF-8')) {|c| c.recover }
    else
      doc = ::Nokogiri::HTML(html, nil, 'UTF-8') {|c| c.recover }
    end

    return doc
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
actionmailer_inline_css-1.3.0 lib/overrides/premailer/adapter/nokogiri.rb