From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Improve error reporting when serializing non-Unicode strings to JSON Date: Sat, 23 Dec 2017 15:07:59 +0000 Message-ID: References: <20171222210031.30811-1-phst@google.com> <83efnllufm.fsf@gnu.org> <83wp1dk18g.fsf@gnu.org> <83shc1jy3j.fsf@gnu.org> <83r2rljxpg.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c03457e1d428b0561034d97" X-Trace: blaine.gmane.org 1514041588 20056 195.159.176.226 (23 Dec 2017 15:06:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 23 Dec 2017 15:06:28 +0000 (UTC) Cc: phst@google.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 23 16:06:24 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 1eSlNU-0004cy-O2 for ged-emacs-devel@m.gmane.org; Sat, 23 Dec 2017 16:06:20 +0100 Original-Received: from localhost ([::1]:42839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSlPT-000423-2i for ged-emacs-devel@m.gmane.org; Sat, 23 Dec 2017 10:08:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSlPJ-000411-Dt for emacs-devel@gnu.org; Sat, 23 Dec 2017 10:08:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSlPI-0001dd-EF for emacs-devel@gnu.org; Sat, 23 Dec 2017 10:08:13 -0500 Original-Received: from mail-qt0-x231.google.com ([2607:f8b0:400d:c0d::231]:42872) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eSlPG-0001cA-TN; Sat, 23 Dec 2017 10:08:11 -0500 Original-Received: by mail-qt0-x231.google.com with SMTP id g9so39368225qth.9; Sat, 23 Dec 2017 07:08:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Z5qZwn3Jp9mZmZJsswrz4Y9XqB1AnUhsemGgyN84vvI=; b=ASMi/5N1LNO8KvkZH7Y9D6CJ4izMppzpg2xv7wCIBXXooZRi0ux/AfKJ3P1+9PlIeL VwHH9JgPQrFGqZkb+0/lE788gQvLDjsHnwcDoxNLkuby/oK2DUhfCmvvV+zj/onfyi0v qKFPx9Q3Ka8igugcn0Ppl0eHXGKXEIgt8ffTwyceg97Q3z4HeuHN/BCY86GD/4Rgq8Pj Vq6C0I8PZNZaTahlfnhz+n3jlDu3e0YSnMVk3Sa+BUMxwGG8SRbw5Qy5P0s7yflWBVXY eMBknWnNcQdyWszriEER6xCYwC8wG+3Nddpu+Zm/BGZsOANfNbK3Gj/Rk1HMV3yt11qD 5oyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Z5qZwn3Jp9mZmZJsswrz4Y9XqB1AnUhsemGgyN84vvI=; b=VS61YenCO+PDQrIN93RlULbIhQ5VHCyfnRmdmxjKRsyqC6OlU0TQuR/+nkA7CiJWBc wHluOQme8tlk6029TzlBW3IGSOMFNXOXDHcaJ84mEvyu/RYwxe2BdUu1Y36Fpaz8Be8U Al94AjhliRgglEmSfw0cwMBvdoqvrevZODVhzac/02I3tHgY/Elp2viBOx+D4XHyRC1M IxP94AFf1Uq6753JTRrKhlYeSPUmEzKMcGoGhJvAlBKE8NlN/xDyxllnZW74FqrYqvLp VB+kRVCet1n5mQCHgFTGlpAgYPEULaX1gH+JEqkARXQ68MLnz8FqZskmS32+2F542tWo 1m9Q== X-Gm-Message-State: AKGB3mLodhe2a7qit2xcR8DnWrq7vEzdSihh8n/0e/iVdny0YOJm309+ o+NpElHpBu6hyofeBIuGWJhxta6mAawwR6kl45K/Ww== X-Google-Smtp-Source: ACJfBotC2YMtKt/bFhNIG6SdkND1Mmw66O7MM683B8QblOcpjrzLNjq9Q/0IvnuzlYkw7D8oNXEiAJaiSpmtEJO8k0g= X-Received: by 10.200.27.225 with SMTP id m30mr25833672qtk.260.1514041690111; Sat, 23 Dec 2017 07:08:10 -0800 (PST) In-Reply-To: <83r2rljxpg.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::231 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:221381 Archived-At: --94eb2c03457e1d428b0561034d97 Content-Type: text/plain; charset="UTF-8" Eli Zaretskii schrieb am Sa., 23. Dez. 2017 um 16:00 Uhr: > > Date: Sat, 23 Dec 2017 16:52:16 +0200 > > From: Eli Zaretskii > > Cc: phst@google.com, emacs-devel@gnu.org > > > > Btw, doesn't find_charsets_in_text do the same job cleaner and > > quicker? AFAIU, all you need is make sure there are no characters > > from the 2 eight-bit-* charsets in the text, or did I miss something? > > Ah, I see you test the encoded string, so find_charsets_in_text won't > do. But maybe find_charsets_in_text could be called on the original > strings before encoding them, which would be even better? > I'd want to avoid that because it makes the coding check mandatory. With my patch, the additional check only happens in the failure case, when we signal an error. Also find_charsets_in_text seems really hard to use and seems overblown for a simple "is UTF-8" check. --94eb2c03457e1d428b0561034d97 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= Sa., 23. Dez. 2017 um 16:00=C2=A0Uhr:
> Date: Sat, 23 Dec 2017 16:52:16 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: phst@google.c= om, emacs-deve= l@gnu.org
>
> Btw, doesn't find_charsets_in_text do the same job cleaner and
> quicker?=C2=A0 AFAIU, all you need is make sure there are no character= s
> from the 2 eight-bit-* charsets in the text, or did I miss something?<= br>
Ah, I see you test the encoded string, so find_charsets_in_text won't do.=C2=A0 But maybe find_charsets_in_text could be called on the original strings before encoding them, which would be even better?
<= div>
I'd want to avoid that because it makes the coding c= heck mandatory. With my patch, the additional check only happens in the fai= lure case, when we signal an error.
Also find_charsets_in_text se= ems really hard to use and seems overblown for a simple "is UTF-8"= ; check.
--94eb2c03457e1d428b0561034d97--