Skip to content

Commit

Permalink
fixing an encoding error with non-standard chars
Browse files Browse the repository at this point in the history
  • Loading branch information
alokhmutov committed May 17, 2023
1 parent 609256f commit aa209f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/device_detector/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ def matching_regex
# @return [MatchData, nil] MatchData if string matches any regexp, nil otherwise
def regex_find(user_agent, regex_list)
regex_list.find { |r| user_agent =~ r[:regex] }
rescue RegexpError
rescue RegexpError, Encoding::CompatibilityError
# Bug in ruby regex and special characters, retry with clean
# https://bugs.ruby-lang.org/issues/13671
user_agent = user_agent.encode(
Expand Down

0 comments on commit aa209f8

Please sign in to comment.