Eli Zaretskii schrieb am Sa., 23. Dez. 2017 um 09:28 Uhr: > > From: Philipp Stephani > > Date: Fri, 22 Dec 2017 22:00:31 +0100 > > Cc: Philipp Stephani > > > > * admin/merge-gnulib (GNULIB_MODULES): Add unistr modules. > > > > * lib/Makefile.in (.c.o): Fix output file for files in subdirectories. > > (${DEPDIR}/unistr, unistr/u8-check.o): Create missing deps directory. > > > > * 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'm not sure I understand the need for this. Emacs never does that > anywhere else, it just converts the invalid bytes to a special > character set. An application that cares could then test for presence > of those bytes to see if anything like that happened. What am I > missing? > This patch only improves the error symbol when trying to serialize a non-Unicode string to JSON. Right now this raises "out of memory", which is somewhat confusing. This patch improves this to raise "wrong-type-argument".