lib/scss_lint/engine.rb in scss_lint-0.44.0 vs lib/scss_lint/engine.rb in scss_lint-0.45.0

- old
+ new

@@ -22,11 +22,15 @@ elsif options[:code] build_from_string(options[:code]) end # Need to force encoding to avoid Windows-related bugs. + # Need to encode with universal newline to avoid other Windows-related bugs. # Need `to_a` for Ruby 1.9.3. - @lines = @contents.force_encoding('UTF-8').lines.to_a + encoding = 'UTF-8' + @lines = @contents.force_encoding(encoding) + .encode(encoding, universal_newline: true) + .lines.to_a @tree = @engine.to_tree find_any_control_commands rescue Encoding::UndefinedConversionError, Sass::SyntaxError, ArgumentError => error if error.is_a?(Encoding::UndefinedConversionError) || error.message.match(/invalid.*(byte sequence|character)/i)