Re: [ietf-smtp] quoted-unprintable ?

Tony Finch <dot@dotat.at> Thu, 25 March 2021 16:33 UTC

Return-Path: <fanf2@hermes.cam.ac.uk>
X-Original-To: ietf-smtp@ietfa.amsl.com
Delivered-To: ietf-smtp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1E00E3A26FE for <ietf-smtp@ietfa.amsl.com>; Thu, 25 Mar 2021 09:33:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.648
X-Spam-Level:
X-Spam-Status: No, score=-1.648 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a9YnHRPlwSVu for <ietf-smtp@ietfa.amsl.com>; Thu, 25 Mar 2021 09:32:58 -0700 (PDT)
Received: from ppsw-43.csi.cam.ac.uk (ppsw-43.csi.cam.ac.uk [131.111.8.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 551D13A26FC for <ietf-smtp@ietf.org>; Thu, 25 Mar 2021 09:32:58 -0700 (PDT)
X-Cam-AntiVirus: no malware found
X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus
Received: from [90.251.56.255] (port=57876 helo=milebook.lan) by ppsw-43.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:25) with esmtpsa (PLAIN:fanf2) (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1lPSuf-000DHs-oj (Exim 4.94) (return-path <fanf2@hermes.cam.ac.uk>); Thu, 25 Mar 2021 16:32:49 +0000
Date: Thu, 25 Mar 2021 16:32:49 +0000
From: Tony Finch <dot@dotat.at>
To: Ned Freed <ned.freed@mrochek.com>
cc: John Levine <johnl@taugh.com>, ietf-smtp@ietf.org
In-Reply-To: <01RWXI9W6HXE0085YQ@mauve.mrochek.com>
Message-ID: <80798a9f-d15-b647-e387-f83e4986caa6@dotat.at>
References: <20210321174103.BB02470D9908@ary.qy> <01RWXI9W6HXE0085YQ@mauve.mrochek.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Sender: Tony Finch <fanf2@hermes.cam.ac.uk>
Archived-At: <https://mailarchive.ietf.org/arch/msg/ietf-smtp/wUzzKwfaDBu_7yYJLp35NTVMhzU>
Subject: Re: [ietf-smtp] quoted-unprintable ?
X-BeenThere: ietf-smtp@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Discussion of issues related to Simple Mail Transfer Protocol \(SMTP\) \[RFC 821, RFC 2821, RFC 5321\]" <ietf-smtp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ietf-smtp>, <mailto:ietf-smtp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ietf-smtp/>
List-Post: <mailto:ietf-smtp@ietf.org>
List-Help: <mailto:ietf-smtp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ietf-smtp>, <mailto:ietf-smtp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Mar 2021 16:33:03 -0000

Ned Freed <ned.freed@mrochek.com> wrote:
>
> > The advantage of BINARYMIME over base64 is that base64 is 33% bigger
> > since it encodes six bits per octet rather than 8.  It occurs to me
> > that since everone these days supports 8BITMIME, one could invent a
> > quoted-unprintable encoding that encodes only the characters that are
> > special, CR LF NUL.  (To play it safe I'd also encode 0xff). This gets
> > you about a 2% size increase and stays compatible with 8BITMIME.
>
> It's actually kind of tricky if you want to avoid pathological cases.
> Combining the encoding with compression is the simplest way to avoid
> that, since it's unlikely in the extreme that the compression scheme
> will spit out a high percentage of any specific character.

Stuart Cheshire and Mary Baker have a super elegant binary escaping scheme
called "consistent overhead byte stuffing" (COBS) that has a guaranteed
overhead of less than 1%.

http://www.stuartcheshire.org/papers/COBSforToN.pdf

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  https://dotat.at/
Fisher, German Bight, Humber, Thames, Dover, Wight, Portland:
Southwest 4 to 6, occasionally 7 later. Slight or moderate, becoming
mainly moderate, occasionally rough later except in Dover and Thames.
Showers. Mainly good.