/* * call-seq: to_json(*) * * This string should be encoded with UTF-8 A call to this method * returns a JSON string encoded with UTF16 big endian characters as * \u????. */ static VALUE mString_to_json(int argc, VALUE *argv, VALUE self) { VALUE result = rb_str_buf_new(RSTRING_LEN(self)); rb_str_buf_cat2(result, "\""); JSON_convert_UTF8_to_JSON(result, self, strictConversion); rb_str_buf_cat2(result, "\""); FORCE_UTF8(result); return result; }