Use iconv when ruby doesn't know how to encode

There are three jammy fixes:

  1. Ruby can't encode everything, use iconv for this
  2. Even iconv doesn't like UTF-16, use UTF-16BE instead
  3. Regexp doesn't like dummy encodings, so use a binary encoding

Unfortunately, since JRuby doesn't like native C extensions we can't run this on JRuby platforms.