diff options
author | Eli Zaretskii <eliz@gnu.org> | 2019-11-23 11:27:43 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2019-11-23 11:27:43 +0200 |
commit | c26556bd18f8ca1e891bd1750c9f95b21ea457b0 (patch) | |
tree | 6d13489bbc75c0b0eef4d38b8df9ee290cf7e5ef /src/json.c | |
parent | 6d4d00c63417e3479e978a373f252b9f2709ce39 (diff) | |
download | emacs-c26556bd18f8ca1e891bd1750c9f95b21ea457b0.tar.gz |
Fix and speed up en/decoding of UTF-8 strings
* 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.
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c index 5a3d0012f0a..cd3b9cc0236 100644 --- a/src/json.c +++ b/src/json.c @@ -228,7 +228,7 @@ json_encode (Lisp_Object string) { /* FIXME: Raise an error if STRING is not a scalar value sequence. */ - return code_convert_string (string, Qutf_8_unix, Qt, true, true, true); + return encode_string_utf_8 (string, Qnil, false, Qt, Qt); } static AVOID |