diff options
| author | Philipp Stephani | 2017-12-23 17:56:36 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2017-12-30 23:16:51 +0100 |
| commit | a5835dfee139322de7aa071f1c87ef015acbecad (patch) | |
| tree | 992b5222049f2aa2a124f8c3484bbd074eaecfd1 /src/coding.h | |
| parent | 30ffc256abe7443a02b44490c518baf9a122b4c8 (diff) | |
| download | emacs-a5835dfee139322de7aa071f1c87ef015acbecad.tar.gz emacs-a5835dfee139322de7aa071f1c87ef015acbecad.zip | |
Improve error reporting when serializing non-Unicode strings to JSON
* src/coding.c (utf8_string_p): New helper function.
(syms_of_coding) <utf-8-unix>: Move from json.c.
* src/json.c (json_check_utf8): New helper function.
(lisp_to_json_toplevel_1, lisp_to_json): Use it. To save a bit of
time, check for invalid UTF-8 strings only after encountering an
error, since Jansson already rejects them.
* test/src/json-tests.el (json-serialize/invalid-unicode): Adapt
expected error symbol.
Diffstat (limited to 'src/coding.h')
| -rw-r--r-- | src/coding.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/coding.h b/src/coding.h index 66d125b07e6..bc4ef52e1ed 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -665,6 +665,7 @@ struct coding_system | |||
| 665 | /* Extern declarations. */ | 665 | /* Extern declarations. */ |
| 666 | extern Lisp_Object code_conversion_save (bool, bool); | 666 | extern Lisp_Object code_conversion_save (bool, bool); |
| 667 | extern bool encode_coding_utf_8 (struct coding_system *); | 667 | extern bool encode_coding_utf_8 (struct coding_system *); |
| 668 | extern bool utf8_string_p (Lisp_Object); | ||
| 668 | extern void setup_coding_system (Lisp_Object, struct coding_system *); | 669 | extern void setup_coding_system (Lisp_Object, struct coding_system *); |
| 669 | extern Lisp_Object coding_charset_list (struct coding_system *); | 670 | extern Lisp_Object coding_charset_list (struct coding_system *); |
| 670 | extern Lisp_Object coding_system_charset_list (Lisp_Object); | 671 | extern Lisp_Object coding_system_charset_list (Lisp_Object); |