os97673/regexp_m17n — pull request #96 by emyl (2014-08-08 20:34:43+00:00)
Title: Two-liner with bonus tests

The idea is trivial: convert the input string to the regexp's encoding (which can be any non-dummy encoding) before doing the match.

Using `String.encode`, instead for example `String.force_encoding`, should ensure a successful match whenever possible, ever for conversions from dummy encodings (e.g. `ISO-2022-JP` -> `UTF-8`).

There are three distinct cases where conversion fail. For each one I've provided a trivial test that ensure that the correct exception is raised:

* Code converter doesn't exist (e.g. `ISO-2022-JP-2` or `UTF-7`)
* Invalid byte sequence
* Undefined conversion between encodings

In such cases, IMHO, the method **must** raise the exception. I prefer to *prove that this is impossible* to write a monkey patch or call an external program.

And now… popcorn time! :corn: