From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#60750: 29.0.60; encode-coding-char fails for utf-8-auto coding system Date: Thu, 12 Jan 2023 14:44:29 +0100 Message-ID: <871qnzg94y.fsf@gmail.com> References: <87zgaof7cg.fsf@gmail.com> <83fscgaq6j.fsf@gnu.org> Mime-Version: 1.0 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="3776"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60750@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 12 14:46:21 2023 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 1pFxuP-0000hT-6e for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Jan 2023 14:46:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFxtA-0006lX-Mx; Thu, 12 Jan 2023 08:45:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFxt8-0006lL-On for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 08:45:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFxt8-00023I-GB for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 08:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pFxt8-0001lI-1l for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 08:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Jan 2023 13:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60750 X-GNU-PR-Package: emacs Original-Received: via spool by 60750-submit@debbugs.gnu.org id=B60750.16735310806727 (code B ref 60750); Thu, 12 Jan 2023 13:45:02 +0000 Original-Received: (at 60750) by debbugs.gnu.org; 12 Jan 2023 13:44:40 +0000 Original-Received: from localhost ([127.0.0.1]:45036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFxsl-0001kQ-Mt for submit@debbugs.gnu.org; Thu, 12 Jan 2023 08:44:40 -0500 Original-Received: from mail-wm1-f44.google.com ([209.85.128.44]:39597) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFxsj-0001kE-Ho for 60750@debbugs.gnu.org; Thu, 12 Jan 2023 08:44:38 -0500 Original-Received: by mail-wm1-f44.google.com with SMTP id p3-20020a05600c1d8300b003d9ee5f125bso10105977wms.4 for <60750@debbugs.gnu.org>; Thu, 12 Jan 2023 05:44:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=SGgLqeVSIbQW3ZerByqm/SkhM9/QYLgkN7S7KHKCsUk=; b=XgH4lOqxc0PpMlEN54mIx8Y3Zh7d6xaMBtbunGSXwMK98eBje/0CvBsUJAKn9kZghU Di5HZVhLJ69XcKBrdlymKgansYihr8hxM7n+jcgogDkAaWbAcBspHy7lq41DN26rZK+F o0ltcrSGb5Nz5X4DyrhlLU1gHBvojB683s+K1oK+xWkCPi47G2yl11Gp8I7p70Hq/YwA dNQL8pwyH975Ob6wgM6WHnkeP94wEoBtQNvIBUmmKZbbjEpI0dA4KFaduZqluL2qbmg+ It1lPnlu7ussg+fJ2oTw6FN/Py/XzwyrayMa+oVPXT01lYa7I5fUACqaCCodIi1+zI3o WsmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SGgLqeVSIbQW3ZerByqm/SkhM9/QYLgkN7S7KHKCsUk=; b=A5JA8n2h1ywPtIf6XvUP7l+cLGgQn+DjHXyIpYKRTZeR/vFXIenZOvaG6rgCZPeTTi 6zSKgQutj+73hggGnffi1ZziRM5YrLqFbf1/Vs7p1Qpmn/vGUexMRv+nXhzB53cNpUjf iyn6/HtK4tJM6xc4t8PqLXwfAEH92+kT7daFA39B0HcHuoyOoh1XSaNyMV+OofXIs/4D TBLIUUKWGxMxMFaPbLt3flB3xMv+kP1SPR4tlKdfvOUSDTMiDf0pmVlQZxG67dMks3Qw J7QymWrg95MvIK4C0+RsPvUVmPNX7ABf4IqBTF/XF/ASPNlXXGBNH0L0VaY+dcoXC/tH cpBA== X-Gm-Message-State: AFqh2ko8oWb3eNAeOoc9HVRBdSqw/YFuCXgOn/QOlaoqyo9J5iNVQ6AT pM1i93INRCTTRkPFiOtdel14bMA0Jw4= X-Google-Smtp-Source: AMrXdXtBtugdTumqLqwE531KYxaW57Yrcrlw/zBEK3fAZTfu6i7/dgswZIkqq1r+21PeBZPHpwmcUQ== X-Received: by 2002:a05:600c:510b:b0:3d2:392e:905f with SMTP id o11-20020a05600c510b00b003d2392e905fmr55741125wms.24.1673531071144; Thu, 12 Jan 2023 05:44:31 -0800 (PST) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id l36-20020a05600c1d2400b003d9fb59c16fsm9642356wms.11.2023.01.12.05.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 05:44:30 -0800 (PST) In-Reply-To: <83fscgaq6j.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 12 Jan 2023 14:32:52 +0200") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253226 Archived-At: >>>>> On Thu, 12 Jan 2023 14:32:52 +0200, Eli Zaretskii said: Eli> Actually, the doc string is clear: Eli> If the value is a cons cell, on decoding, check the first two by= tes. Eli> If they are 0xFE 0xFF, use the car part coding system of the val= ue. Eli> If they are 0xFF 0xFE, use the cdr part coding system of the val= ue. Eli> Otherwise, treat them as bytes for a normal character. On encod= ing, Eli> produce BOM bytes according to the value of =E2=80=98:endian=E2= =80=99. Eli> Note the last sentence: it should unconditionally produce the BOM = on Eli> encoding. Which is what we do in your scenario. Ah, I misread that as "depending on the value of ':endian'" One minor nit, the description for ':endian' says: `:endian' VALUE must be `big' or `little' specifying big-endian and little-endian respectively. The default value is `big'. This attribute is meaningful only when `:coding-type' is `utf-16'. That last sentence seems untrue, as ':endian' is meaningful for 'utf-8-auto' >> (I=CA=BCm willing to be told that buffer-file-coding-system shouldn= =CA=BCt be >> 'utf-8-auto, but I never set that explicitly as far as I know =F0=9F= =98=80) Eli> Who does set utf-8-auto? where did you originally bump into this? Eli> This is an obscure coding-system, and the fix to make it work as Eli> documented will produce an incompatible change in behavior. So be= fore Eli> I decide whether to make the change and on what branch, I'd like to Eli> know how in the world did you encounter this. It=CA=BCs entirely my own fault: The file where I noticed this is shared between a GNU/Linux and a macOS machine, which means I foolishly added the following a year ago, even though it=CA=BCs unnecessary (perhaps I was thinking I was going to be sharing it with a Windows machine?): ;; -*- lexical-binding: t; coding: utf-8-auto; -*- I think that means we can leave the code as it is. Robert --=20