Contest

I may be wildly off base but I think this works. All I did was to make sure that the string at the heart of the Regexp and the comparison input string were both in the same encoding. This conversion of the string/regexp may defeat the intended simple matching purpose.

For Ruby v.2.1.1 this works for all encodings except two (ISO-2022-JP-2 and UTF-7), for which there is no converter (cannot even represent the utf-8 "." into those encodings, so it fails before I can even call the non_empty? method).