🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #78684

Re: [Xnews] [MacSOUP] Problems with MIME-encoded subjects

#78684
From: Werner Jakobi
Date: Wed, 16 May 2001 19:36
97 lines
4743 bytes
thomas@wkaz.net (Thomas LEMOINE) posted:

>First, the MacSOUP problem: if I understand correctly the RFCs, the 
>subject shouldn't be cut in the middle of a word, but rather between
>two words, as the whole <CR><LF><whitespace> represents a single
><SP>. 

This would be correct if you take only regard of RFC 822/2822.
But combining this whith RFC 2047, which reqests any ammount of 
whitespace between 2 immediatey following encoded sections, you can 
fold coded sections at any convenient position between 2 nonwhitespace 
chars.

Folding unfolding can now be done in two steps.

Example:
Subject: Hommage à Te Zuka, le grand mâitre du manga.

must first be encoded (max. 76 chars per line!)

Subject: Hommage =?iso-8859-1?Q?=E0 Te Zuka, le gra...
Oups, will be longer than allowed, lets make a new coded sequence.

Subject: Hommage =?iso-8859-1?Q?=E0 Te Zuka, le gra?=<blank>=?iso-8859-1?Q?nd m=E2itre?= du manga.

Now this can be folded at <blank> which gives you about the result you 
explained.

>Second, the Xnews problem: the subjects were half-decoded, and it
>wasn't even the same half all the time.

This seems to be a problem of Xnews. A line can be composed of several 
encoded and nonencoded sections. Even different encodings are allowed.

>Addendum if it may help Luu find the problem: two more articles in
>this thread had more or less similar behaviour. The second one (same
>author and newsreader as the firstone ) read at first:
>
>>Re: Hommage à Te Zuka, le grand  =?ISO-8859-1?Q?m=E2itre?= du
>>manga. 

Adding whitespace is a typical problem of Netscape. It always adds a 
'\t' when folding. Even when it folds outsides an encoded section.

The following code can be taken for corectly unfolding header lines:

// Concatenate folded Headerlines
// Folding can be practiced by replacing any whitespace by CRLF-whitespace.
// Whitespace itself remains integral part of the folded line (RFC 822).
     wxString* LineP; wxString* NextP;
     *LineP = Getline(conn); *NextP = Getline(conn);
     while(NextP->StartsWith(" ") || NextP->StartsWith("\t"))
     {
       *LineP += *NextP;
	 *NextP = Getline(conn);
     }

// RFC 2047 requests at least one (or more) whitespace between 2
// imediately following coded sequences. When decoding, this whitespace 
// must be deleted.
     if (LineP->Find("?=") > 0)
     {
       for(size_t i = 0; i < (LineP->Len()-5); i++)
       {
         if ((LineP->Mid(i,2)) == "?=")
         {
           i += 2;
           size_t j = i;
           wxString l = *LineP;
           while (j < l.Len() &&
             (l[j] == ' ' || l[j] == '\t')) j++;
           if (LineP->Mid(j, 2) == "=?")
             *LineP = LineP->Left(i) + LineP->Mid(j);
           i = j-1;
         }
       }
     }
// Netscape inserts a \t when folding.
     {
       int tab;
       while ((tab = LineP->Find('\t')) > 0)
       {
         wxString tmp = LineP->Mid(tab+1);
         *LineP = LineP->Left(tab);
         if (LineP->StartsWith(CTYPHDR)) *LineP << ' ';
         *LineP << tmp;
       }
     }

HAND, Werner
-- 
Morver, the wheel chair for ill Windows-Newsreaders and for OE.
Actual version 0.8.221: http://home.t-online.de/home/werner.jakobi/
Technical Details
Message-ID: <9duqsn.3vvi0bh.1@jakobi-28216.user.dfncis.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail
References: <Xns90A3B938BA490.thomas@condor.wkaz.net>

Show Full Headers
Complete Article Headers
Message-ID: <9duqsn.3vvi0bh.1@jakobi-28216.user.dfncis.de>
Subject: Re: [Xnews] [MacSOUP] Problems with MIME-encoded subjects
Date: Wed, 16 May 2001 21:36:15 +0200
From: Werner Jakobi <Werner.Jakobi@bigfoot.com>
References: <Xns90A3B938BA490.thomas@condor.wkaz.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!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: Ji-Enterprises
Lines: 96
Reply-To: <werner.jakobi@t-online.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: news.t-online.com 990041775 00 6532 iuYOSEmSSLAGtB 010516 19:36:15
X-Complaints-To: abuse@t-online.com
X-Sender: 320037279015-0002@t-dialin.net
User-Agent: Xnews/4.04.07
X-Face: &z]O&rxl_4T+Gn:i?gpA18IcGGjDl[q'5Oe]=CyP|20n)`*|XDuK1a;/'`kB'chCy7$?[2M0sGb{-Q@-.F2<,T>#1"K"\}VDis!6=3lG@jl:!reT>9!9=k&gII-JD@W=+'rGyuI
X-Converter: MorVer Version 0.8.221
X-KorrNews: Used