emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Improve error reporting when serializing non-Unicode strings


From: Philipp Stephani
Subject: Re: [PATCH] Improve error reporting when serializing non-Unicode strings to JSON
Date: Sat, 30 Dec 2017 22:20:26 +0000



Philipp Stephani <address@hidden> 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. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]