Thread View: news.software.nntp
14 messages
14 total messages
Started by Colin Sarsfield
Wed, 24 May 2000 00:00
uuencoded text attachments rejected
Author: Colin Sarsfield
Date: Wed, 24 May 2000 00:00
Date: Wed, 24 May 2000 00:00
9 lines
821 bytes
821 bytes
Hello, I am writing a news client and have found that some servers will reject uuencoded text files. What criteria does the server use to determine if a file is a text file? Thank you, Colin Sarsfield
Re: uuencoded text attachments rejected
Author: Colin Sarsfield
Date: Wed, 24 May 2000 00:00
Date: Wed, 24 May 2000 00:00
18 lines
1435 bytes
1435 bytes
On 25 May 2000 00:40:04 GMT, Jeremy <bofh@netscum.dk> wrote: >Well, don't post them, then. There is no reason to. Yes, I agree. I should have been clearer. I was wondering what range of ASCII characters is considered a "text" file. Obviously, anything over 127 is 8 bits and needs encoding. How about characters 0-7, 11-12, & 14-31 ? Do they qualify as text? Also, I was thinking that uuencoding files with lines longer than 80 characters would preserve line endings (useful for source code, esp. languages like python). And what about text files with unix or mac line ending conventions (I assume these should be translated to the netnews CRLF pair)? Thanks again, Colin
Re: uuencoded text attachments rejected
Author: Russ Allbery
Date: Wed, 24 May 2000 00:00
Date: Wed, 24 May 2000 00:00
42 lines
2598 bytes
2598 bytes
Colin Sarsfield <colin.sarsfield@usa.net> writes: > Yes, I agree. I should have been clearer. I was wondering what range > of ASCII characters is considered a "text" file. Obviously, anything > over 127 is 8 bits and needs encoding. I don't find that obvious at all. Most news clients can handle 8-bit character sets just fine provided that they're properly labelled. The only text that should generally ever be encoded is text containing unprintable control characters. > How about characters 0-7, 11-12, & 14-31 ? Do they qualify as text? No. I would recommend using quoted-printable if you have a few of those characters in the text and base64 encoding if you have a lot of them. In both cases, proper MIME labelling is vital. You should also consider the possibility that the occurance of any such characters may be by accident; I'd strongly recommend not just encoding the text but instead prompting the person first to see if they're sure they want to post something containing control characters. I would never recommend using uuencode for any new application. > Also, I was thinking that uuencoding files with lines longer than 80 > characters would preserve line endings (useful for source code, > esp. languages like python). Just posting them with long lines will preserve line endings just fine. News servers and clients should be able to handle lines of arbitrary length in the body and have no business rewrapping lines outside of a news reader explicitly configured to do that (and should preferrably obey format=filled when possible). > And what about text files with unix or mac line ending conventions (I > assume these should be translated to the netnews CRLF pair)? Yup. -- Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Re: uuencoded text attachments rejected
Author: Andrew Gierth
Date: Wed, 24 May 2000 00:00
Date: Wed, 24 May 2000 00:00
15 lines
1310 bytes
1310 bytes
>>>>> "Colin" == Colin Sarsfield <colin.sarsfield@usa.net> writes: Colin> Hello, I am writing a news client and have found that some Colin> servers will reject uuencoded text files. What criteria does Colin> the server use to determine if a file is a text file? uuencoded text (and html) is commonly rejected because it is used by spammers to disguise their spam. If you're posting text, why inflate it by over a third by encoding it? -- Andrew.
Re: uuencoded text attachments rejected
Author: Russ Allbery
Date: Wed, 24 May 2000 00:00
Date: Wed, 24 May 2000 00:00
25 lines
2008 bytes
2008 bytes
Andrew Gierth <andrew@erlenstar.demon.co.uk> writes: > No. Quoted-printable specifically _doesn't_ handle differences in line > ending conventions of _text_ data. You can of course treat the data as a > non-text type, e.g. application/octet-stream, instead. The theory basically goes like this, as I understand it: If it's a text file, then the line endings don't convey any information beyond "this is the end of the line" and you can convert line endings arbitrarily as necessary for the protocol and for the conventions of the local operating system. All you need is some way of recognizing where lines end so that you can convert as necessary. If you have to preserve a *particular* line end convention, then the file is no longer a text file (since text files do not have any specific line ending convention apart from those enforced by the protocol). It's a binary and must be encoded as a binary (normally using base64 encoding, but the important part is the MIME content label). There are close parallels to text vs. binary mode in FTP transfers. -- Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Re: uuencoded text attachments rejected
Author: Jeremy
Date: Thu, 25 May 2000 00:00
Date: Thu, 25 May 2000 00:00
20 lines
1452 bytes
1452 bytes
Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote: > No. Quoted-printable specifically _doesn't_ handle differences in line > ending conventions of _text_ data. You can of course treat the data as > a non-text type, e.g. application/octet-stream, instead. Hm. I just tried a MIME-attachment of a text file with CRLF line endings, attached as text/plain; charset=us-ascii, with a transfer-encoding of quoted-printable, and mailed it to myself on a Unix system, and it preserved the line endings. With a 7bit transfer-encoding, it stripped them. Was my test invalid, or is Mutt just handing it wrong? My newsreader (trn) can grok MIME, but Pnews doesn't post attachments, so I didn't test it in news. -- Jeremy ( jeremy@exit109.com | bofh@netscum.dk )
Re: uuencoded text attachments rejected
Author: Andrew Gierth
Date: Thu, 25 May 2000 00:00
Date: Thu, 25 May 2000 00:00
31 lines
2238 bytes
2238 bytes
>>>>> "Jeremy" == Jeremy <bofh@netscum.dk> writes: > Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote: >> No. Quoted-printable specifically _doesn't_ handle differences in line >> ending conventions of _text_ data. You can of course treat the data as >> a non-text type, e.g. application/octet-stream, instead. Jeremy> Hm. I just tried a MIME-attachment of a text file with CRLF Jeremy> line endings, attached as text/plain; charset=us-ascii, with Jeremy> a transfer-encoding of quoted-printable, and mailed it to Jeremy> myself on a Unix system, and it preserved the line endings. Jeremy> With a 7bit transfer-encoding, it stripped them. Jeremy> Was my test invalid, or is Mutt just handing it wrong? This is probably Mutt handling it slightly wrong. Did the QP form of the message have lines ending in =0D? If so, then what was happening was: input line in local format: "foo<CR>" (delimited by LF) converted to canonical form: "foo<CR><CRLF>" converted to QP: "foo=0D<CRLF>" and then converted back the same way. However, the canonical form is illegal under the rules for text/plain, which require that CR not occur except as part of a linebreak (always <CRLF> in canonical form). -- Andrew.
Re: uuencoded text attachments rejected
Author: Jeremy
Date: Thu, 25 May 2000 00:00
Date: Thu, 25 May 2000 00:00
11 lines
836 bytes
836 bytes
Colin Sarsfield <colin.sarsfield@usa.net> wrote: > Hello, I am writing a news client and have found that some servers will > reject uuencoded text files. Well, don't post them, then. There is no reason to. -- Jeremy ( jeremy@exit109.com | bofh@netscum.dk )
Re: uuencoded text attachments rejected
Author: Andrew Gierth
Date: Thu, 25 May 2000 00:00
Date: Thu, 25 May 2000 00:00
61 lines
3234 bytes
3234 bytes
>>>>> "Jeremy" == Jeremy <bofh@netscum.dk> writes:
> Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote:
>> input line in local format: "foo<CR>" (delimited by LF)
>> converted to canonical form: "foo<CR><CRLF>"
>> converted to QP: "foo=0D<CRLF>"
>>
>> and then converted back the same way. However, the canonical form is
>> illegal under the rules for text/plain, which require that CR not
>> occur except as part of a linebreak (always <CRLF> in canonical form).
Jeremy> But, thinking about this, is it really wrong? After encoding, there
Jeremy> is no bare CR in the text. Or is it prohibited even in encoded form?
It's prohibited in the _canonical_ form:
4.1.1. Representation of Line Breaks
The canonical form of any MIME "text" subtype MUST always represent a
line break as a CRLF sequence. Similarly, any occurrence of CRLF in
MIME "text" MUST represent a line break. Use of CR and LF outside of
line break sequences is also forbidden.
This rule applies regardless of format or character set or sets
involved.
All encodings of text/* types must convert to this canonical form
before applying the content-transfer-encoding.
For an example of why the above still doesn't work, consider that on a
platform that uses CRLF as the native delimiter the decoded text will
be:
"foo<CR><CR><LF>"
and on a platform that uses CR,
"foo<CR><CR>"
so the data has been mangled anyway in spite of the QP encoding.
You _can_ encode text with a specific line ending convention in QP,
you just have to do it as some media type other than text/*, and avoid
using hard line breaks in the encoding. For example, you could do
this:
Content-Type: multipart/mixed; boundary="cut-here--"
--cut-here--
Content-Type: application/octet-stream
Content-Transfer-Encoding: quoted-printable
this is text with MSDOS-type line endings that should be received=0D=0A=
intact by any conforming MIME implementation.=0D=0A
--cut-here----
This only works inside a compound MIME type such as multipart/mixed,
though, because of the need to omit the final line break in the
enclosed entity. (A QP-encoded entity can't end with a soft line
break.)
--
Andrew.
Re: uuencoded text attachments rejected
Author: Jeremy
Date: Thu, 25 May 2000 00:00
Date: Thu, 25 May 2000 00:00
42 lines
2521 bytes
2521 bytes
Colin Sarsfield <colin.sarsfield@usa.net> wrote: > Yes, I agree. I should have been clearer. I was wondering what range > of ASCII characters is considered a "text" file. That's probably not what the servers in question are looking at, for what it's worth. > Obviously, anything over 127 is 8 bits and needs encoding. No, not necessarily. News can be *mostly* 8-bit clean. You can have things like � and � and �, which are >127, in your posts without having to encode them. You just have to specify the correct character set in your MIME headers (look at my headers for an example). > How about characters 0-7, 11-12, & 14-31 ? Do they qualify as text? They sound like control characters to me. If you really have some need to include them in a Usenet post, it would be far better to use some other encoding rather than uuencoding the whole text file. Best not to include them at all in the regular body of a post, as many people can't display them very well. In attachments, quoted-printable might be the way to go. > Also, I was thinking that uuencoding files with lines longer than 80 > characters would preserve line endings (useful for source code, esp. > languages like python). What is messing up line endings on you? You can have lines longer than 80 characters. If they get wrapped, that's a client issue. > And what about text files with unix or mac line ending conventions (I > assume these should be translated to the netnews CRLF pair)? If you need to attach a text file in such a way that you need to preserve the line ending conventions, I think it would be better to use quoted-printable rather than uuencode or base64. -- Jeremy ( jeremy@exit109.com | bofh@netscum.dk )
Re: uuencoded text attachments rejected
Author: Andrew Gierth
Date: Thu, 25 May 2000 00:00
Date: Thu, 25 May 2000 00:00
18 lines
1628 bytes
1628 bytes
>>>>> "Jeremy" == Jeremy <bofh@netscum.dk> writes: >> And what about text files with unix or mac line ending conventions >> (I assume these should be translated to the netnews CRLF pair)? Jeremy> If you need to attach a text file in such a way that you need Jeremy> to preserve the line ending conventions, I think it would be Jeremy> better to use quoted-printable rather than uuencode or Jeremy> base64. No. Quoted-printable specifically _doesn't_ handle differences in line ending conventions of _text_ data. You can of course treat the data as a non-text type, e.g. application/octet-stream, instead. -- Andrew.
Re: uuencoded text attachments rejected
Author: Jeremy
Date: Thu, 25 May 2000 00:00
Date: Thu, 25 May 2000 00:00
17 lines
1294 bytes
1294 bytes
Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote: > input line in local format: "foo<CR>" (delimited by LF) > converted to canonical form: "foo<CR><CRLF>" > converted to QP: "foo=0D<CRLF>" > > and then converted back the same way. However, the canonical form is > illegal under the rules for text/plain, which require that CR not > occur except as part of a linebreak (always <CRLF> in canonical form). But, thinking about this, is it really wrong? After encoding, there is no bare CR in the text. Or is it prohibited even in encoded form? -- Jeremy ( jeremy@exit109.com | bofh@netscum.dk )
Re: uuencoded text attachments rejected
Author: Colin Sarsfield
Date: Thu, 25 May 2000 00:00
Date: Thu, 25 May 2000 00:00
3 lines
908 bytes
908 bytes
Thanks for everybody's help on this subject.
Re: uuencoded text attachments rejected
Author: Jeremy
Date: Thu, 25 May 2000 00:00
Date: Thu, 25 May 2000 00:00
11 lines
919 bytes
919 bytes
Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote: > This is probably Mutt handling it slightly wrong. Did the QP form of > the message have lines ending in =0D? Yes, it did. -- Jeremy ( jeremy@exit109.com | bofh@netscum.dk )
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