# File lib/sprockets/utils.rb, line 34 def self.read_unicode(pathname) pathname.read.tap do |data| # If the file is UTF-8 and theres a BOM, strip it for safe concatenation. if data =~ UTF8_BOM_PATTERN data.sub!(UTF8_BOM_PATTERN, "") # If we find a UTF-16 BOM, theres nothing we can do on # 1.8. Only UTF-8 is supported. elsif data =~ UTF16_BOM_PATTERN raise EncodingError, "#{pathname} has a UTF-16 BOM. " + "Resave the file as UTF-8 or upgrade to Ruby 1.9." end end end