From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id C67C522385 for ; Sun, 25 Feb 2024 19:51:00 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1708887060; b=pQtjgteXsLwd4H1OttdA0xKaCQgKerngLxVeKYpwwvVTZ0P+ZtTy2EKXxOlirfBVMnFWib9e9m 84dvNc51nDRD/NLlAlqlz9Bn/von/jiAA7n8ke+uxwpOSLdNVD8FYsRkPSJ+RLNq3xJJS7t/nR w5bZrktrQjI+ZPZUzOkgJ/dN13oB8N6efrzROnlMz8TONl01rm3f9MvrNscVzD+get806sZTRW aV+P2F80jnamSgiNq0FO/qZMsFDF/LV2FkbP4ZnaqVGQzLovFFZxG0E/0ag04VV8W5go6mapoX U1k9Ouro6gs9ZpB4n9jR+QhNZhzE6PanFAi3LCDkhM3VdA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay7-d.mail.gandi.net) smtp.remote-ip=217.70.183.200; dmarc=none header.from=chazelas.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1708887060; bh=xldygNFuoCI9PbIsrsYnezVUe0Dxt9f9VLVy98OqjZE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature; b=CQ9g2dRmZTpKRZXA7Vc7SvOezFmvsh8XQaUG4fPCb6FvYwQpK4O84NBrVc/XZ+uzKICUdFHkCE EVqjdqt0ncoyCtds2bdXGy0j72wG5IVkdBnGHmI5x8q50Zt3ZF5pdhA8QmsWKK/bndROqs7MDb /r2JtD65RWjtCDj+OUJD8uTfWOhdfNGPVK835BWpK3ghQ+U2YaFp2zv1d5+h0BtOwU6aUmYWK8 zi7vGiJCyjEi/t7WpHv3AhZQ5lhODKZIKrJOxcoN9foMrFDSrAMpDNQaCKJmbZhPg9fFrjScIh hPCyKVEIj5t3czpRliJX1zI07Y261qeeRYZRFGxunYUdkg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=LAvokPw3V6WOFckogw/Cpcbbbe2tzIQJd3s2YUCfKZU=; b=G1EbKRv4ccWeFFnJbRVptrU+pu AemiuoJUXqunp3CkcuOSO7QT4IDUjrtGYvYhQY9i8CUp9Yk+M8H7LIoAqmzSUKVvqdro0CTbaOxYv SqtP/2LybNvKGmoyxM7noVv0tIqtqO0VDqMm3w/TbCeHoX4haYxSZU++v18XS1Ip9ncgsakHoPSCx ZFgUk3OyfRWJ7DVJ/EhPBgI4AWazF9gOumndKEwxqo2wcF+S01DdazxTjvzJQt1oGgcNed/1oYVJ6 WTAUjKQYetTAQzJixyGCUvgg0nz1WneXfPH6yk2QKs0sA3XEbyrE5fwd5kA0HUaNd68hT3taYZaZN T2N5YQKg==; Received: by zero.zsh.org with local id 1reJaV-0004aO-IZ; Sun, 25 Feb 2024 18:50:59 +0000 Authentication-Results: zsh.org; iprev=pass (relay7-d.mail.gandi.net) smtp.remote-ip=217.70.183.200; dmarc=none header.from=chazelas.org; arc=none Received: from relay7-d.mail.gandi.net ([217.70.183.200]:37353) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1reJaF-0004Im-AD; Sun, 25 Feb 2024 18:50:43 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id C545920003; Sun, 25 Feb 2024 18:50:41 +0000 (UTC) Date: Sun, 25 Feb 2024 18:50:40 +0000 From: Stephane Chazelas To: "Mark J. Reed" Cc: Zsh hackers list Subject: Re: \M-^C vs \203 vs \x83 as visual representations of bytes Message-ID: <20240225185040.556pkrig7prtibck@chazelas.org> Mail-Followup-To: "Mark J. Reed" , Zsh hackers list References: <20240225090751.yqb23ewm4pgocg7e@chazelas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-GND-Sasl: stephane@chazelas.org X-Seq: 52609 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: 2024-02-25 12:26:35 -0500, Mark J. Reed: > Wow; I had no idea Zsh printed out nonprintable characters that way. I > concur that it would make sense to change, modulo backward compatibility > considerations. Maybe a settable option? [...] Note that I'm not suggesting zsh stop accepting it on input, but to change the output format. On input, zsh supports \203 and \x83 more widely than \M-\C-C Supported by print and $'...' $ print '\x83\203\M-\C-C' | sed -n l \203\203\203$ $ print -r $'\x83\203\M-\C-C' | sed -n l \203\203\203$ But not: $ echo '\x83\203\M-\C-C' | sed -n l \203\\203\\M-\\C-C$ $ echo '\x83\0203\M-\C-C' | sed -n l \203\203\\M-\\C-C$ $ printf '\x83\0203\M-\C-C\n' | sed -n l \203\0203\\M-\\C-C$ So I wouldn't think the switch would break backward compatibility. Switching to \203 or \x83 would actually improve compatibility with other shells. Ksh has \CC instead of \C-C (inside $'...') and it's \M-C seems to expand to ^[C (and \M-c doesn't seem to be recognised). In ksh however, \xfff is the same as \ufff (while \xff is not the same as \uff) and you need \x[ff]f or \x{ff}f to have a 0xff byte followed by f. So the output would not be compatible with ksh if switching to \xHH. $ ksh -c 'printf "%q\n" "$@"' ksh $'\xff' $'\xfff' $'\xff' $'\x[ff]f' See also https://github.com/ksh93/ksh/commit/ac8991e5257978a6359c001b7fa227c334fd9e18 -- Stephane