Thread View: news.software.nntp
4 messages
4 total messages
Started by J.B. Moreno
Tue, 31 Jul 2001 18:06
Re: yEncode: A quick and dirty 8 bit encoding method
Author: J.B. Moreno
Date: Tue, 31 Jul 2001 18:06
Date: Tue, 31 Jul 2001 18:06
76 lines
4326 bytes
4326 bytes
In article <3b67be46.14498597@127.0.0.1>, The Archiver <archiver@i3w.com> wrote: > Please read my other message (yEnc - 8 bit encoding) which is related > to this text. Thanks. > > - - - - - snip - - - - - > > yEncode - A quick and dirty encoding for binaries > -------------------------------------------------- > Version 1.0 - 31-July-2001 - by Juergen@Helbing.de If you think it might change you need to include a version number as part of the overhead. -snip- > Principle > -------- > The principle of encoding is really simple: A few special characters > are reserved from the 8-bit-charset, one character is used as escape > character to encode the 'critical' ones. > Critical characters are usually: NULL, TAB, CR, LF. > (The list could be easily extended - if necessary) > As escape character we use the '=' equal sign. 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... > 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. 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. You'd want to change your boundary to '=-' or something instead of '=y' but that shouldn't be a problem. That means that =A=1 means 2 nulls. Notice this means that your worse case for escaping is a 1 character penalty per escaped character, and your average and best cases are much better... I was talking to Brian Clark about the QP-Lite encoding and he pointed out that it's good to have various types of error checking. You are including a byte count which is good, how about extending that a bit and including a single (base 192) number at the beginning of each line indicating either the number of characters on the wire or the number of characters that the line expands to (depending upon how you want to do things). 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). > Headers and Trailers > -------------------- > 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. -- J.B. Moreno
Re: yEncode: A quick and dirty 8 bit encoding method
Author: J.B. Moreno
Date: Wed, 01 Aug 2001 17:26
Date: Wed, 01 Aug 2001 17:26
126 lines
6473 bytes
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
Re: yEncode: A quick and dirty 8 bit encoding method
Author: The Archiver
Date: Fri, 03 Aug 2001 07:36
Date: Fri, 03 Aug 2001 07:36
98 lines
4584 bytes
4584 bytes
"J.B. Moreno" <planb@newsreaders.com> wrote: >> 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. Extra escaping should be really avoided. >> 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. Yes, the theory says that. But because a general approach would add a lot of complexity I tend to use simple solutions. I'm not sure if the tendency of the last few years - trying to find very general approaches - is a good one. >> 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. I would really love to implement also compression. But if I'd really do this, then I would prefer to use a 'good' compressor, not just RLE encoding. Perhaps I misunderstand you in this case - but actually I've got a problem with mixing up the different things. My primary target (which is not reachable) would be to introduce real 8 bit transfer. Then the best compressors could be used. As an 'intermediate' solution (and reachable target) a better - and simple - encoding should be used. Between both targets there is a huge range of options. And now I'm completely unsure what way should be gone for Usenet. >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. I understand now that this would be a requirement for RLE. Thanks. >> 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. > >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. Yes, doubling the dot only if it is in the first column is the easier way than to escape it generally. Thanks. >> 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. Sounds good - and easy. >> But this should be really discussed in a MIME group. >> Any recommendations for a group ? > >comp.mail.mime would be my first choice. Sigh - I did avoid to touch mail as long as possible. More lessons to learn.... Thanks for taking the time to scan my proposal so extensively. This did help me a lot. -- Juergen, [The Archiver]
Re: yEncode: A quick and dirty 8 bit encoding method
Author: J.B. Moreno
Date: Sat, 04 Aug 2001 02:04
Date: Sat, 04 Aug 2001 02:04
111 lines
5357 bytes
5357 bytes
In article <34369.381202@archiver.winews.net>, The Archiver <archiver@i3w.com> wrote: > "J.B. Moreno" <planb@newsreaders.com> wrote: > -snip- > >> 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. > > Yes, the theory says that. > But because a general approach would add a lot of complexity > I tend to use simple solutions. > > I'm not sure if the tendency of the last few years - trying to find very > general approaches - is a good one. Well, there's always a trade-off no matter what you do. You simply have to ask yourself whether the result does what you want at a price you consider acceptable. -snip- > >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. > > I would really love to implement also compression. > But if I'd really do this, then I would prefer to use a 'good' compressor, > not just RLE encoding. A better compression algorithm will be more complex than can be easily handled in an encoding scheme who's main good point is that it allows the use of all 8 bits in a byte. > Perhaps I misunderstand you in this case - but actually I've got a > problem with mixing up the different things. > > My primary target (which is not reachable) would be to introduce > real 8 bit transfer. Then the best compressors could be used. Sure, but RLE is great for use in combinations with some other process, it can be layered upon top of the other process, helping when it can and costing nothing when it can't. > As an 'intermediate' solution (and reachable target) a better > - and simple - encoding should be used. > > Between both targets there is a huge range of options. > And now I'm completely unsure what way should be gone > for Usenet. Well, you're not going to introduce a great or even an especially good compression step into Usenet -- not without a whole lot of work. OTOH, switching over to QP-lite or whatever is feasible as long as it's kept fairly simple. I'm not completely unsure, but I'm not complete sure either -- I still have some doubts, my two primary "pros" (which may be at odds with one another) is availability of tools to handle it, and the ability to easily add it to existing tools or even to do it manually. My con's are simply the reverse of the pro's -- complexity and no support. I think the rotating scheme that Y uses is an added complexity that precludes using simple text editing tools for decoding so it can't be done manually, and there's no pre-existing support for it. The same thing is of course true (mainly) for the RLE extension that I suggested as well. My inclination is that the extra 3-5% saving isn't worth it at this point, let that come latter (i.e. no rotating, no RLE). But if you're going to include one or the other (or I guess both), it should only be after analyzing a lot of posts to see which would produce better results. -snip- > >> 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. > > Sounds good - and easy. Yep. > >> But this should be really discussed in a MIME group. > >> Any recommendations for a group ? > > > >comp.mail.mime would be my first choice. > > Sigh - I did avoid to touch mail as long as possible. > More lessons to learn.... Hopefully you'll be able to get your MIME help without worrying about the mail portion of it. > Thanks for taking the time to scan my proposal so extensively. > This did help me a lot. Glad to hear it. -- J.B. Moreno
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads