🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #240926

Re: Message encodings

#240926
From: Ralph Fox
Date: Mon, 17 May 2010 12:17
51 lines
3120 bytes
On Sat, 15 May 2010 13:56:38 +0100, in message <69i2c7-7o4.ln1@gate.cowlark.com> 
David Given <dg@cowlark.com> wrote:

> Usenet messages are, AIUI, supposed be either (a) valid MIME messages
> with a content-type, charset and transfer-encoding; or (b) non-MIME
> messages in 7-bit ASCII.
> 
> However, in practice there are lots of messages floating around that
> violate these rules, usually by using high-bit bytes where they're not
> supposed to (either in headers, where they're supposed to use MIME
> encoded-words instead, or in a message body in a non-MIME message).
> 
> What's the best thing to do when decoding these? Do I just treat them as
> ISO-8859-1 and hope for the best, or are there better heuristics I
> should use?
> 
> (Incidentally, is it the case these days that all NNTP servers are 8-bit
> clean? If not, does anyone know of a free news server that will
> correctly reencode messages in 7-bit that I can use for testing?)


For high-bit bytes in _HEADERS_


A.  The single best strategy, today, is to assume the header
    uses the same charset as the body.

B.  To future-proof things, it would be better to first detect
    whether the header is valid UTF-8.
    •  If it is, take the header as being charset = UTF-8
    •  If not, take it as being the same charset as the body.

    The world isn't there yet — in fact, some clients still
    cannot handle headers and bodies using different charsets.
    But it is the roadmap for the future.  


C.  If you cannot get the charset of the body, either because
    (a)  the message has no MIME content-type, charset header; or
    (b)  the body is 7-bit US-ASCII but the headers are 8-bit;

    then use the same kind of heuristic as you would for the body:

    (1)  Select a default charset depending on the prevailing
         language of the newsgroup
    (2)  If you can, make exceptions for individual posters.


-- 
Regards
Ralph
Technical Details
Message-ID: <p2c2v5l7o4ij1344k8q4b3bm5069isv6tf@4ax.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.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder1.xlned.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!newsfeed2.telusplanet.net!newsfeed.telus.net!news-in-02.newsfeed.easynews.com!easynews!core-easynews-01!easynews.com!en-nntp-13.dc1.easynews.com.POSTED!not-for-mail
References: <69i2c7-7o4.ln1@gate.cowlark.com>

Show Full Headers
Complete Article Headers
Message-ID: <p2c2v5l7o4ij1344k8q4b3bm5069isv6tf@4ax.com>
Subject: Re: Message encodings
Date: Tue, 18 May 2010 00:17:35 +1200
From: Ralph Fox <-rf-nz-@-.invalid>
References: <69i2c7-7o4.ln1@gate.cowlark.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.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder1.xlned.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!newsfeed2.telusplanet.net!newsfeed.telus.net!news-in-02.newsfeed.easynews.com!easynews!core-easynews-01!easynews.com!en-nntp-13.dc1.easynews.com.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: No; Y2.038Chaos instead!
X-Newsreader: Forte Agent 6.00/32.1186
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit
Lines: 51
X-Complaints-To: abuse@easynews.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise
 we will be unable to process your complaint properly.