🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #53593

Re: yEncode: A quick and dirty 8 bit encoding method

#53593
From: J.B. Moreno
Date: Wed, 01 Aug 2001 17:26
126 lines
6473 bytes
In article <21579.181203@archiver.winews.net>, The Archiver
<archiver@i3w.com> wrote:

> "J.B. Moreno" <planb@newsreaders.com> wrote:
> 
-snip-
> >Tab's shouldn't be a problem -- if you were using an existing format
> >like QP which is already being used for text message, it might be a
> >problem, but as you're not...
> 
> I would be happy to remove TABs.
> But I've already seen one server which does not accept 
> 8-bit-lines with a DOT in the first column with 127 chars behind 
> it. So it will be necessary to include the removal of the TAB 
> into a comprehensive test.

Not a problem for testing, but it'd normally just be extra escaping to
no purpose.

> >> A lot of binaries are using a lot of NULL characters - so the entire
> >> character table is rotated by 42:  0-> 42, 1->43, .... 255 -> 41
> >> So just a few exotic bytes will be encoded with the escape character.
> >> And these 'exotic' codes have usually a probability of 0.4%.
> >> With 5 'critical' characters up to 2% of overhead are produced.
> >
> >IME nulls especially often run in sequence, which suggests that the
> >best thing to do is to add some minimal compression in order to avoid
> >the problem with overescaping.  And since nulls are what you'd be most
> >likely to escape, you'll get better milage out of compressing than
> >rotating.
> 
> The rotation of the character table by 42 is used _before_ the
> encoding is done. So NULL chars from the binary are convert to
> '*' before encoding - and stay just one byte.
> (This is exactly why I did introduce my own proposal).

That doesn't really change things -- whatever you escape can appear
frequently in the content and then you have a problem because of the
doubling necessary for straight escaping.

> >Perhaps something like: '=' is the escape, followed by '1' for null,
> >'2' for CR, '3' for LF and '=' for an equal sign, otherwise it's a
> >single base 192 number (where zero equals 0x40) followed by the
> >(potentially escaped) byte to be expanded.  
> 
> I did specify the '=' as Escape character.
> And =M ist ascii-13, =J is ascii-10
> (64 is added to the escaped charcter).
> This allows easily to add more characters which must be escaped.
> The decoder will always fetch the second character, subtract 64
> (and then 42 ) and then write the result to the output stream.

Yeah, it allows you to escape anything, but it doesn't lend itself to
compression.  What I described above is a simple Run Length Encoding
compression and although it doesn't save a lot of space, it should save
enough that the rotating is unnecessary.


> >You'd want to change your boundary to '=-' or something instead of
> >'=y' but that shouldn't be a problem. 
> 
> Is there a special reason why you recommend this ?

With the escape and RLE method that I described, =y can happen when you
have 57 characters in a row with the same value -- i.e. =y=1 would be a
block of 57 nulls.

-snip-
> >That would limit your line length to 192 (before or after
> >encoding) but would give the ability to detect in-transit damage (it
> >also nicely avoids the problem of having to escape '.' at the beginning
> >of lines).
> 
> I believe that my proposal offers enough ability to detect damage already.
> And the '.' int he first column: You are right. As mentioned in my other
> reply it is necessary to escape also the '.' in the first column.
> I had already problems with 128 long lines which had a '.' in the
> first column. I dont know why that server messed it up, but it did.
> And the 'escaping' is introduced ONLY to deal with existing server
> trouble. So my actual release (and the 1.1 for this document) will
> also specify '.' for escaping.

This isn't a matter of sever trouble -- the spec says you don't do
that.  This would simply avoid you have to check for it -- if it's
there, there is a standard way of escaping it -- double the period, the
receiving program should automatically be turning double periods at the
beginning of a line into a single period.

> >> It might be possible to embedd such an encoding into the MIME standard
> >> - but this takes a long time - and that standard does not add value.
> >
> >Actually it does -- if you use MIME sections then programs that are
> >totally unaware of your format can extract the information and save it
> >to disk for a standalone decoder to deal with.  This allows a decoder
> >to only worry about decoding, and not extracting.
> 
> I admit that I'm not very familiar with the MIME standard.
> Would it be be possible to introduce something like this:
> 
> ----=_va72mt8pvjni5jk9l195cjs5nevv2sop63.MFSBCHJLHS
> Content-Type: image/jpeg; name=bu_bbg_48.jpg
> Content-Transfer-Encoding: yenc
> Content-Disposition: attachment; filename=bu_bbg_48.jpg
> 
> =ybegin ......  name=bu_bbg_48.jpg
> /9j/4AAQSkZJRgABAQEAlgC
> =yend ......
> 
> ----=_va72mt8pvjni5jk9l195cjs5nevv2sop63.MFSBCHJLHS--

Yes, that wouldn't be a problem.

> I'm not sure how the different news-reader and other tools will
> handle such parts - and how to use filenames with it.....

Most of them should handle it just fine, saving to an encoded file on
disk.

> But this should be really discussed in a MIME group.
> Any recommendations for a group ?

comp.mail.mime would be my first choice.

-- 
J.B. Moreno
Technical Details
Message-ID: <010820011326177216%planb@newsreaders.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!howland.erols.net!portc.blue.aol.com.MISMATCH!portc03.blue.aol.com!feed.newsreader.com!news2.newsreader.com!flame.newsreader.com!planb
References: <3b67be46.14498597@127.0.0.1> <310720011406256023%planb@newsreaders.com> <21579.181203@archiver.winews.net>

Show Full Headers
Complete Article Headers
Message-ID: <010820011326177216%planb@newsreaders.com>
Subject: Re: yEncode: A quick and dirty 8 bit encoding method
Date: Wed, 01 Aug 2001 13:26:17 -0400
From: "J.B. Moreno" <planb@newsreaders.com>
References: <3b67be46.14498597@127.0.0.1> <310720011406256023%planb@newsreaders.com> <21579.181203@archiver.winews.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!howland.erols.net!portc.blue.aol.com.MISMATCH!portc03.blue.aol.com!feed.newsreader.com!news2.newsreader.com!flame.newsreader.com!planb
Newsgroups: news.software.nntp
Organization: bofh wannabe
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: 8bit
User-Agent: Thoth/1.2.4 (Carbon/OS X)
X-Trace: flame.newsreader.com py4Bq9QHP7_Ycnrlw+flKEY5,wc/nOYrn2.fGhRD7=FP.V-
Lines: 125