Article View: news.software.readers
Article #229468When unFolding, you SHOULD ignore each line's leading spaces.
From: Jeffβ²Relf
Date: Fri, 30 Jan 2009 13:16
Date: Fri, 30 Jan 2009 13:16
102 lines
5026 bytes
5026 bytes
β Is X.EXE incapable of wrapping long lines when displaying them? β,
you asked me.
By choice, neither X.EXE nor Visual Studio autoWrap.
When I need to wrap a downloaded post or eMail
I either do it by hand or I click a macro.
Downloaded posts and/or eMails have abbreviated headers;
only the five most-recent Message-IDs are shown, one per line.
β β References: <foo@example.com>
<bar@example.org>
^^ β
There are two spaces where there should be one. β, you wrote.
For the β References: β field,
X.EXE simply puts each Message-ID on its own line,
indented with two spaces β because I like the look.
You SHOULD unFold header fields the same way Google Groups would.
Google Groups and X.EXE get it right; WinMail has some problems,
and ThunderBird actually introduces erroneous whitespace.
When unFolding, you SHOULD ignore each line's leading spaces.
With a minor exception for some 10 year old Netscape ( on Win98 ) posts,
no whitespace is added between the joined lines.
If there is to be whitespace there, it must be either:
A. In an encoded word. or
B. At the end of the first line.
The exception for posts made using 10 year old code goes like this:
a space is added between the joined lines when both:
A. the second line doesn't start with an encoded word. and
B. the first line doesn't end in a space or tab.
In JeffRelf.F-M.FM/X.CPP, a folded line gets allocated
as a single line with careful attention to whitespace.
// ShCache( LnP B ) prints a header and/or post one line at a time.
// B points to the characters to print ( i.e. a header and/or post ).
// Encoded words are converted from whatever charset to UTF-16.
// E_Header points to the last character in the header.
LnP E_Header ;
int ShCache( LnP B ) { LnP P = B, E, PLn ;
int Ch, Ch2, Len, inHdr = B < E_Header ;
aLine:
// Using P, skip to the CR|LF, replacing tabs as you go.
While ( ! CRLF ) if ( Ch == 9 ) * P = 32 ; E = P ;
int Two = -1 ; While ( CRLF ) if ( Ch == 10 ) Two ++ ;
// β Two == 1 β when there's a blank line, ending the header.
if ( ! inHdr || Two || Ch != 9 && Ch != 32 )
// Don't fold anything because either we're not in the header
// or the header was terminated by a blank line
// or the start of the second line is not a space or tab.
goto GotLn ;
WhileWhite; int EncWrd = Ch == '=' && Ch2 == '?' ;
if ( ! ( EncWrd || E[ -1 ] == 32 ) )
// Kluge for posts made using a 10 year old copy of Netscape.
// Add a space between joined lines because:
// A. The first line doesn't begin with an encoded word. and
// B. The second line didn't end in a space.
P -- ;
// UnFolded the lines by moving the first line forward a bit.
LnP NewB = B + ( P - E ); wmemmove( NewB, B, E - B ), B = NewB ;
// goto β aLine: β to see if more unFolding is needed.
goto aLine ;
GotLn:
// Null terminate the ( possibly unFolded ) line,
* E = 0 ;
if ( * B == '.' ) { B ++ ; if ( Eq( Sep, B ) ) B ++ ; }
Len = 1 + E - B, PLn = Inc( Ln ) = MallocTmp ( Len * SzChar );
wmemmove ( PLn, B, Len ), Len -- ;
if ( inHdr )
// Convert encoded words from whatever charset to UTF-16.
HdrShit( PLn, PLn + Len );
// show it on the screen, if you can.
OnScreen();
if ( Two > 0 )
// We've passed the header.
inHdr = 0, P -- ;
if ( ! * P )
// Nothing more to print.
return Len ;
// goto β aLine: β to print the rest of the post and/or header.
B = P ; goto aLine ; }
......
#define While( Should_Loop ) Ch = 1 , P -- ; \
while ( Ch && ( Ch = * ++ P, Ch2 = ! Ch ? 0 : P[ 1 ], Should_Loop ) )
#define CRLF ( Ch == 10 || Ch == 13 )
Technical Details
Message-ID:
<Jeff_Relf@Seattle.2009_Jan.30|5.16am|u>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder.news-service.com!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailReferences:
<gkduvi$l8a$1@nntp.motzarella.org> <48e0c5799fdfb80d229f0aa0ba6d7b07@pseudo.borked.net> <pan.2009.01.29.09.38.56.268811@emteedee.invalid> <1iubghx.sh0rkwwj2mrpN%snipe@spambin.fsnet.co.uk> <Jeff_Relf@Seattle.2009_Jan.29|10.32am|P> <slrngo44c7.rr5.pjr@pjr.motzarella.org>Show Full Headers
Complete Article Headers
Message-ID: <Jeff_Relf@Seattle.2009_Jan.30|5.16am|u> Subject: When unFolding, you SHOULD ignore each line's leading spaces. Date: Fri, 30 Jan 2009 13:16:55 +0000 From: Jeffβ²Relf <Jeff_Relf@Seattle.Test> References: <gkduvi$l8a$1@nntp.motzarella.org> <48e0c5799fdfb80d229f0aa0ba6d7b07@pseudo.borked.net> <pan.2009.01.29.09.38.56.268811@emteedee.invalid> <1iubghx.sh0rkwwj2mrpN%snipe@spambin.fsnet.co.uk> <Jeff_Relf@Seattle.2009_Jan.29|10.32am|P> <slrngo44c7.rr5.pjr@pjr.motzarella.org> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder.news-service.com!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Newsgroups: news.software.readers Lines: 102 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net O2dT851iGyBuUSimyPE9WwC4VwA3xiNidi1beY+igzXbZizBFw Cancel-Lock: sha1:3KZK1QMHc0ETjcwFHh7OFSNG/wc= User-Agent: JeffRelf.F-M.FM/X.ZIP