module Sprockets::Mime
def read_file(filename, content_type = nil)
Returns String file contents transcoded to UTF-8 or in its external
content_type - String MIME type
filename - String path
Public: Read file on disk with MIME type specific encoding.
def read_file(filename, content_type = nil) data = File.binread(filename) if detect = mime_type_charset_detecter(content_type) detect.call(data).encode(Encoding::UTF_8, :universal_newline => true) else data end end