# File lib/haml/util.rb, line 508
    def check_haml_encoding(str, &block)
      return check_encoding(str, &block) if ruby1_8?
      str = str.dup if str.frozen?

      bom, encoding = parse_haml_magic_comment(str)
      if encoding; str.force_encoding(encoding)
      elsif bom; str.force_encoding("UTF-8")
      end

      return check_encoding(str, &block)
    end