From 1a703a1234b5ce8bd934899a17fa778e3a38c301 Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Mon, 6 Jul 2020 01:26:34 -0400 Subject: [PATCH] regex_match_group: handle non UTF-8 encoded strings --- Library/Homebrew/rubocops/extend/formula.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/rubocops/extend/formula.rb b/Library/Homebrew/rubocops/extend/formula.rb index 34b8a4a7f1..b7e5bfccb8 100644 --- a/Library/Homebrew/rubocops/extend/formula.rb +++ b/Library/Homebrew/rubocops/extend/formula.rb @@ -35,7 +35,7 @@ module RuboCop # Checks for regex match of pattern in the node and # sets the appropriate instance variables to report the match def regex_match_group(node, pattern) - string_repr = string_content(node) + string_repr = string_content(node).encode("UTF-8", invalid: :replace) match_object = string_repr.match(pattern) return unless match_object