From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: mattiase@acm.org Newsgroups: gmane.emacs.bugs Subject: bug#52670: legacy base64 encoding of latin-1 Date: Sun, 19 Dec 2021 22:47:15 +0100 Message-ID: <7AAE6196-B9B9-4367-87EC-80DD6304CBCE@acm.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16237"; mail-complaints-to="usenet@ciao.gmane.io" To: 52670@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 19 22:48:19 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mz42U-000437-NV for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Dec 2021 22:48:18 +0100 Original-Received: from localhost ([::1]:41060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mz42T-0002Jp-7G for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Dec 2021 16:48:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mz42G-0002JN-2u for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 16:48:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mz42D-0003ZT-V1 for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 16:48:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mz42D-0007vO-R9 for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 16:48:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: mattiase@acm.org Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Dec 2021 21:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52670 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.163995045930328 (code B ref -1); Sun, 19 Dec 2021 21:48:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Dec 2021 21:47:39 +0000 Original-Received: from localhost ([127.0.0.1]:48387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mz41r-0007t4-Da for submit@debbugs.gnu.org; Sun, 19 Dec 2021 16:47:39 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:42094) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mz41q-0007sv-4w for submit@debbugs.gnu.org; Sun, 19 Dec 2021 16:47:38 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mz41p-0001s9-U4 for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 16:47:37 -0500 Original-Received: from mail1472c50.megamailservers.eu ([91.136.14.72]:44586 helo=mail102c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mz41n-0003VV-07 for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 16:47:37 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1639950438; bh=5IRwzk44AAS2faA1ZFiauzhIec9/cZ1OGvlO1CxAPzU=; h=From:Subject:Date:To:From; b=n6ubGsCFU80juDZanJl5Xdt1Dh9R+N5g/6Y6pAXRYfqAuH2DtYO1vZLMcTR6vSmVu rWsFc4fwWOgf/2fRjwmRZwID/03fF2vJ/HiFErEBFXE4iPXmaeWbKn+kgnAFsXGUqP MHoSyUB92lMjjiHLcjqt4PKHzxVa2QLDgYCWcLrs= Feedback-ID: mattiase@acm.or Original-Received: from smtpclient.apple (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail102c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 1BJLlGJp003709 for ; Sun, 19 Dec 2021 21:47:17 +0000 X-Mailer: Apple Mail (2.3654.120.0.1.13) X-CTCH-RefID: str=0001.0A742F21.61BFA866.0007, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.4 cv=Pr3w0yA3 c=1 sm=1 tr=0 ts=61bfa866 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=IkcTkHD0fZMA:10 a=mDntQ5YlRbmrT1kDOWQA:9 a=QEXdDO2ut3YA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.14.72; envelope-from=mattiase@acm.org; helo=mail102c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222752 Archived-At: For what appears to be historical reasons, the base64 encoding functions = (base64-encode-string etc) treat characters in the range U+0080..U+00FF = as if they were raw bytes in the 127..255 range. This means that (base64-encode-string "=C3=BF") and (base64-encode-string "\xff") return the same result although the strings are completely different. = Attempts to encode other multibyte characters fail (correctly). For = example, (base64-encode-string "=C5=B8") signals an error, as expected. I propose we tighten up the behavior by eliminating the legacy handling = of characters in the U+0080..U+00FF range. Letting the bug stay in = place enables incorrect, brittle and error-prone usage: the functions = are clearly intended to be fed encoded text only and should signal an = error when not, as stated in the manual.