Explain the futility of the quest.

Using regexpes using the =~ operator depends on the encoding of the file they are made in. In addition, matching is only possible if the encoding of the regular expression is compatible with the encoding of the string being matched.
It looks like you only check for default encoding, while original test tried to test for all.
I think the ideal solution is somewhere between: test for as many encoding as possible.