Philipp Stephani <p.stephani2@gmail.com> schrieb am Sa., 23. Dez. 2017 um 17:59 Uhr:
* src/coding.h (EOL_SEEN_NONE, EOL_SEEN_LF, EOL_SEEN_CR)
(EOL_SEEN_CRLF): Move from coding.c.

* src/coding.c (check_utf_8): Make extern.

* 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.

I've pushed a slight variant of this patch to master as a5835dfee1. The only difference is that the UTF-8 check is factored out into a helper function in coding.c.