[ruby/json] Use String#encode instead of rb_str_conv_enc()
https://github.com/ruby/json/commit/1344ad6f66
[ruby/json] Use String#encode instead of rb_str_conv_enc()
if the conversion did not work. But we should be consistent with
the generator here and only accept BINARY or convertible to UTF-8.
https://github.com/ruby/json/commit/1344ad6f66