Article View: news.software.readers
Article #121577Re: [XanaNews] Bugs with MIME
From: Dirk Nimmich
Date: Sun, 09 Mar 2003 22:54
Date: Sun, 09 Mar 2003 22:54
57 lines
3254 bytes
3254 bytes
Colin Wilson wrote: > Patrick Lamaizi�re wrote: >> Encoded words can't be in a quoted string, so i think that >> "Patrick =?iso-8859-1?Q?Lamaizi=E8re?=" is not correct (i'm not sure, >> to confirm). > > That's fine - but if your name was 'Patrick F. Lamaizi�re' you've got a > dilema. There is no dilema. Patrick =?ISO-8859-1?Q?F=2E_Lamaizi=E8re?= is perfectly well encoded according to RFC 2047. Patrick "F." =?ISO-8859-1?Q?Lamaizi=E8re?= would be ok, too. This is my algorithm for encoding words (translated from a former posting to a German speaking newsgroup), for review: For every word determine - the length of that word - if it contains non-atext characters (see RFC 2822) - if it contains non-ASCII characters Now, if there are only atext characters, output everything as is and return. If there are only ASCII characters, output everything as a quoted- string (i.e., do neccessary quoting) and return. Everything from now on has at least one encoded-word in it. As a result, no line must be longer than 76 characters. In consequence, there may be words (namely all that are longer than 75 chars) that must be encoded that otherwise would not have been encoded. (That's why we count the length of words above.) For every word now do the following: * if the word contains only atext and is shorter than 75 chars: - end previous encoded-word, if any (output MIME-Suffix) - if the word doesn't fit in the current line, fold the line - output word, continue with next word * if previous word was an open encoded-word, MIME-output a SP and the word, continue with next word * if MIME prefix (=?<charset>?Q?) + MIME suffix (?=) + 3 additional characters don't fit in the current line, fold the line * output MIME prefix, MIME-output word, continue with next word If the last word was an open encoded-word, end it (output MIME suffix). MIME-output is a function that outputs the word in quoted-printable format and folds the line where necessary (including ending encoded- words and starting new ones in the new line).
Technical Details
Message-ID:
<b4ggml$o7b$02$1@news.t-online.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mailReferences:
<Xns5BB84A85A3BE7plam@news.free.fr> <1047237262.60659.0@doris.uk.clara.net>Show Full Headers
Complete Article Headers
Message-ID: <b4ggml$o7b$02$1@news.t-online.com> Subject: Re: [XanaNews] Bugs with MIME Date: Sun, 9 Mar 2003 23:54:13 +0100 From: Dirk Nimmich <nimmich@muenster.de> References: <Xns5BB84A85A3BE7plam@news.free.fr> <1047237262.60659.0@doris.uk.clara.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Newsgroups: news.software.readers Organization: T-Online Lines: 56 Sender: Dirk Nimmich <dirk@roxel.fqdn.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.t-online.com 1047250453 02 24811 JsnoEIbGS-YMsS 030309 22:54:13 X-Complaints-To: abuse@t-online.com X-ID: rBfkdYZDYeVzC6maP89O2t3Ad7WbMl71mcn2hTIj53NBcXTaiJmQ4l