πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #240937

Re: Message encodings

#240937
From: David Given
Date: Mon, 17 May 2010 22:47
30 lines
2640 bytes
On 15/05/10 13:56, David Given wrote:
[...]
> What's the best thing to do when decoding these?

Thank-you to everyone responding --- I am reading the discussion with
great interest. But there's just too much to reply to individually
without spamming the thread silly.

Having had a look at the internals of the MIME decoder library I'm using
it would appear that I'm pretty limited to what I can do with headers
anyway --- it decodes headers on the fly, assuming they're valid, and I
can't change it to decode them after it's seen the Content-Type header
without some major reengineering. So I'm just going to use Cp1252 for
the headers and hope for the best.

But I can do heuristics for the text body. Thunderbird seems to be doing
that. I think it ought to be fairly easy, as I can regular expressions
to check for UTF-8 validity etc.

As a pathological example you may be amused by
<4lUWFG$gHg@bbs.sjtu.edu.cn>, which I've just found: not only is it
encoded in gb2312, but it contains raw gb2312 sequences in the headers
and ANSI escape sequences in the signature. You'll be relieved to know I
have no intention of supporting *those*.

-- 
β”Œβ”€β”€β”€ ο½„ο½‡οΌ ο½ƒο½ο½—ο½Œο½ο½’ο½‹οΌŽο½ƒο½ο½ ───── http://www.cowlark.com ─────
β”‚
β”‚ life←{ ↑1 ⍡∨.^3 4=+/,Β―1 0 1∘.βŠ–Β―1 0 1∘.βŒ½βŠ‚β΅ }
β”‚ --- Conway's Game Of Life, in one line of APL
Technical Details
Message-ID: <elt8c7-q42.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.ams3.giganews.com!border1.nntp.ams2.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.k-dsl.de!eternal-september.org!.POSTED!not-for-mail
References: <69i2c7-7o4.ln1@gate.cowlark.com>

Show Full Headers
Complete Article Headers
Message-ID: <elt8c7-q42.ln1@gate.cowlark.com>
Subject: Re: Message encodings
Date: Mon, 17 May 2010 23:47:41 +0100
From: David Given <dg@cowlark.com>
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.ams3.giganews.com!border1.nntp.ams2.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.k-dsl.de!eternal-september.org!.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: Cowlark Technologies
Lines: 30
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 17 May 2010 23:08:04 +0000 (UTC)
Injection-Info: mx02.eternal-september.org;
 posting-host="Bln4lvsxm3O6cyccKODn8w";
 logging-data="27243"; mail-complaints-to="abuse@eternal-september.org";
 posting-account="U2FsdGVkX1/yWivpFmcNPNWd5mefGYRVEF+uVZ6wjko="
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
In-Reply-To: <69i2c7-7o4.ln1@gate.cowlark.com>
Cancel-Lock: sha1:dsQE84TxE0ch8j7NSipgYXQoifQ=
X-Original-Bytes: 2473