From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Improve error reporting when serializing non-Unicode strings to JSON Date: Sat, 23 Dec 2017 10:28:29 +0200 Message-ID: <83efnllufm.fsf@gnu.org> References: <20171222210031.30811-1-phst@google.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1514017665 15761 195.159.176.226 (23 Dec 2017 08:27:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 23 Dec 2017 08:27:45 +0000 (UTC) Cc: phst@google.com, emacs-devel@gnu.org To: Philipp Stephani Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 23 09:27:41 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSf9d-0003UQ-Hp for ged-emacs-devel@m.gmane.org; Sat, 23 Dec 2017 09:27:37 +0100 Original-Received: from localhost ([::1]:40986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSfBc-0003cu-15 for ged-emacs-devel@m.gmane.org; Sat, 23 Dec 2017 03:29:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSfAa-0003Nk-07 for emacs-devel@gnu.org; Sat, 23 Dec 2017 03:28:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSfAZ-0001OY-7T for emacs-devel@gnu.org; Sat, 23 Dec 2017 03:28:35 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSfAS-0001Mq-Kw; Sat, 23 Dec 2017 03:28:28 -0500 Original-Received: from [176.228.60.248] (port=3393 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eSfAS-0001e7-2C; Sat, 23 Dec 2017 03:28:28 -0500 In-reply-to: <20171222210031.30811-1-phst@google.com> (message from Philipp Stephani on Fri, 22 Dec 2017 22:00:31 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221367 Archived-At: > 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?