module JSON::TruffleRuby::Generator
def utf8_to_json(string, script_safe = false) # :nodoc:
UTF16 big endian characters as \u????, and return it.
Convert a UTF8 encoded Ruby string _string_ to a JSON string, encoded with
def utf8_to_json(string, script_safe = false) # :nodoc: string = string.b if script_safe string.gsub!(SCRIPT_SAFE_ESCAPE_PATTERN) { SCRIPT_SAFE_MAP[$&] || $& } else string.gsub!(ESCAPE_PATTERN) { MAP[$&] || $& } end string.force_encoding(::Encoding::UTF_8) string end