• Eli Zaretskii's avatar
    Fix and speed up en/decoding of UTF-8 strings · c26556bd
    Eli Zaretskii authored
    * src/coding.c (get_char_bytes, encode_string_utf_8)
    (decode_string_utf_8): Fix commentary.
    (encode_string_utf_8): Return the original ASCII string only
    if NOCOPY is non-zero.
    (decode_string_utf_8): Accept 2 additional arguments STR and
    STR_LEN, which allow to pass the input text as a C string.
    (make_string_from_utf8): Delegate the job to decode_string_utf_8.
    * src/coding.h: Update the prototype of decode_string_utf_8.
    * src/json.c (json_encode): Call encode_string_utf_8.
    c26556bd
json.c 37.7 KB