From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: bug#23750: 25.0.95; bug in url-retrieve or json.el Date: Fri, 2 Dec 2016 21:53:16 +0700 Message-ID: References: <6d0c8c2e-8428-2fdb-0d6e-899f7b9d7ffd@nifty.com> <8053af81-80e1-a24a-f649-8ffc86963ed5@nifty.com> <0cc7fab4-9a2c-6a8d-def7-36bd50317ca3@yandex.ru> <7f9a799f-de88-fd78-0cdc-dac0928f1503@nifty.com> <308bb78f-8be3-092d-d877-e129d340242b@nifty.com> <4dc615e7-ec73-60a5-426e-0d6986f15d76@yandex.ru> <0cb406fb-ffc4-a4ad-557a-2cacc99b8e75@nifty.com> <86ccb4af-5719-c017-26bb-fc06b4c904d2@yandex.ru> <83r35uxkr5.fsf@gnu.org> <4e12d4ad-cd6b-3087-5d7c-449d4c1886e2@yandex.ru> <83lgw1q9uu.fsf@gnu.org> <83eg1tq8is.fsf@gnu.org> <787e5206-53e0-752f-a339-4608d2f7ad39@yandex.ru> <837f7lq6lg.fsf@gnu.org> <83bmwvpo0o.fsf@gnu.org> <04e2da4e-1fa3-4483-459c-32f272378486@yandex.ru> <83vav2mmsl.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1480690451 14758 195.159.176.226 (2 Dec 2016 14:54:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 2 Dec 2016 14:54:11 +0000 (UTC) Cc: Philipp Stephani , Emacs developers , kentaro.nakazawa@nifty.com, Lars Magne Ingebrigtsen , Dmitry Gutov To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 02 15:54:07 2016 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 1cCpDu-0002n7-5R for ged-emacs-devel@m.gmane.org; Fri, 02 Dec 2016 15:54:02 +0100 Original-Received: from localhost ([::1]:34951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCpDy-0002Rl-3n for ged-emacs-devel@m.gmane.org; Fri, 02 Dec 2016 09:54:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCpDs-0002Rg-He for emacs-devel@gnu.org; Fri, 02 Dec 2016 09:54:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cCpDr-0002Bn-OR for emacs-devel@gnu.org; Fri, 02 Dec 2016 09:54:00 -0500 Original-Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:35472) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cCpDp-0002AX-PD; Fri, 02 Dec 2016 09:53:58 -0500 Original-Received: by mail-lf0-x243.google.com with SMTP id p100so22291701lfg.2; Fri, 02 Dec 2016 06:53:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=lVE6OkVFCzFm0Dl2E0avv4f7WLM64bx7aRTQWRNBUgk=; b=Y56D3j1cGJvvEy1yDET3N6NQPc30qVgwOhrj8ZOcQN4BVNWMvU++Vr03TzN+Vg0pV5 TQq8ya1s6ie9tygMoYCsZJIzKAQA45R6273yMbhaXjq7jAQBlUzHRNX5kQ1hsFju0Tn9 8VWGQSXh4xH8Kpt0pDFs8k7AduuXPzy178gXqpmU7WJx4SnZ2HJ0XndAEJ2KYABAeEhp 9lQMwm/bu36diYW+0NagR5lp/6iXjVkjP/cPBklDR5xltRFHRQL/MuwJz+fqlEi5tMSs BSqF3kWRPTOyMkTBpp1DN/gX0k7fD8TUI513nptJeAAQn/t+2ThUjznZNJ15meSghBH1 1stA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=lVE6OkVFCzFm0Dl2E0avv4f7WLM64bx7aRTQWRNBUgk=; b=munCqwNr1o45CShwHiDew4/2jj5OWEYqEFYBEKLpN6zMp1FWTJg71iWuO5+HE5M6tn QYLbBu3f2n+v1Nv17sKMGKdJbuPi3cp3KyxC0SCwehMCp7HxDVvwAoqrG4m1BFabqOLH J/QF8Y9qQ+NEsBtXxde+4dcpTfAO3QSASS6wFKc9mfnqmUbM4/gFkTAnXUvqaufHxAJw 95VKeCzEZ5K2GkJi7pfLglFz8OWGOpxxLdqY1+voiboWT01ej3dWbg0m/HaHwylKmmUL T90lxB79XHskpkuaaKI1jxUCQah3N4As/FLcgi2dk2X/dTLp9GVCzeeUqvIGYp4THXgl 0X2Q== X-Gm-Message-State: AKaTC00TKNLzdqMCgMLIyCLObHPynjCKEjWWj1MWwc4y7Vr8GzHmBv3X1Cz1MaTtsDy4PzTmTAuLnlJp025PjA== X-Received: by 10.25.15.36 with SMTP id e36mr14347399lfi.19.1480690417031; Fri, 02 Dec 2016 06:53:37 -0800 (PST) Original-Received: by 10.114.77.161 with HTTP; Fri, 2 Dec 2016 06:53:16 -0800 (PST) In-Reply-To: <83vav2mmsl.fsf@gnu.org> X-Google-Sender-Auth: RwMn9Xga3iFcJxA9CyfQ7MbmMTc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::243 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:209923 Archived-At: On Fri, Dec 2, 2016 at 9:24 PM, Eli Zaretskii wrote: >> + (when (mutibyte-string-p request) >> + (error "Multibyte text in HTTP request: %s, please translate any >> multibyte components to unibyte using `encode-coding-string'" request)) >> (url-http-debug "Request is: \n%s" request) >> request)) > > This will also reject pure-ASCII strings that just happen to be > multibyte, although there will be no problem with such an HTTP > request. Do we really want to disallow that use case? It is really unfortunate that we talk about ASCII strings, unibyte strings, multibyte strings, as if that was a meaningful classification. The real dichotomy is between text (aka strings) and MIME-type-tagged byte arrays. In order to send a string over HTTP, one must encode it to a byte array and tag it as "text/plain; charset=utf-8" or "text/html; charset=utf-8" or application/json (no charset parameter because json must always be encoded in one of utf-* for transmission). Conversely, a byte array received over HTTP can, MIME type allowing, decoded into a string. The fact that there exist strings for which encoding and decoding are identity transforms should be regarded only as an implementation detail. Attempts by libraries and frameworks to silently DTRT for this subset lead to applications neglecting to properly encode or tag strings, leading, in turn, to breakage in presence of multilingual text.