Proposed fix, noted issue with test case assertion and modified as necessary

 - Changed non_empty? to encode the regex string before processing
 - Added precondition to non_empty? to check for presence of dummy encoding
 - Modified test case assertion (needs to be done, per creator of Ruby)