module Sprockets::EncodingUtils

def charlock_detect(str)

Returns encoded String.

To enable this code path, require 'charlock_holmes'

Internal: Use Charlock Holmes to detect encoding.
def charlock_detect(str)
  if defined? CharlockHolmes::EncodingDetector
    if detected = CharlockHolmes::EncodingDetector.detect(str)
      str.force_encoding(detected[:encoding]) if detected[:encoding]
    end
  end
  str
end