module Sprockets::EncodingUtils

def detect_html(str)

Returns a encoded String.

str - String.

Public: Detect charset from HTML document. Defaults to ISO-8859-1.
def detect_html(str)
  str = detect_unicode_bom(str)
  # Attempt Charlock detection
  if str.encoding == Encoding::BINARY
    charlock_detect(str)
  end
  # Fallback to ISO-8859-1
  if str.encoding == Encoding::BINARY
    str.force_encoding(Encoding::ISO_8859_1)
  end
  str
end