🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #264285

Re: trn 4 and UTF-8 (was: Is there a way to respond to an expired article if you know the message ID?)

#264285
From: Eli the Bearded
Date: Wed, 05 Aug 2020 18:05
114 lines
5692 bytes
In news.software.readers, Adam H. Kerman <ahk@chinet.com> wrote:
> Eli the Bearded <*@eli.users.panix.com> wrote:
>> 1. As distributed, it has a bug stripping highbit control characters
>>   which munge UTF-8. The hack fix is use -j to disable all control
>>   character filtering. Real fix is to disable highbit control 
>>   character filtering:
> I didn't know that. Thank you for bringing it to my attention.

Not the first time I've posted that patch here because I think it needs
more attention.

>> 2. When reading articles not in US-ASCII or the local encoding, trn
>>    makes no attempt to convert characters to the local encoding, but
>>    just dumps them to the screen. Typically (for me) this means
>>    ISO-8859-1 being sent raw to my UTF-8 system.
> I want this as a feature. I refuse to use UTF-8 to send typographical
> punctuation characters and especially nonbreaking whitespace, neither of
> which belong in plain text communication. As much as possible, I
> substitute genuine ASCII for typographical punctuation characters, and a
> genuine whitespace character for nonbreaking whitespace.

I've modified my local copy of Pnews to check article encoding. I use
checkutf8, which is a program I wrote and have code with my mailx
package ( https://github.com/eli-the-bearded/eli-mailx ).

checkutf8="/usr/local/contrib/bin/checkutf8 -v"
check8859="/usr/local/contrib/bin/check8859 -v"
checkascii="/usr/local/contrib/bin/checkascii -v"
[...]
    check)
	# only check headers for charset declarations, and only if
	# valid MIME (has a Mime-Version: header).
        $sed -ne '1,/^[	 ]*$/ p' $tmpart > $tmpart.head
	result=
	# with no declartion, assume ASCII
	cstest=$checkascii
	if $grep -i '^mime-version:.*1' > /dev/null $tmpart.head ; then
		if $grep -Ei 'charset=[^a-z0-9]?utf-8' > /dev/null $tmpart.head ; then
			cstest="$checkutf8"
		fi
		if $grep -Ei 'charset=[^a-z0-9]?iso-8859' > /dev/null $tmpart.head ; then
			cstest="$check8859"
		fi
		if $grep -Ei 'charset=[^a-z0-9]?[us-]*ascii' > /dev/null $tmpart.head ; then
			cstest="$checkascii"
		fi
	fi
	result=`$cstest $tmpart`

	if $test "X$result" != X ; then
		$echo "Warning failed character set test $cstest:"
		$echo "$result"
	fi
	$rm -f $tmpart.head

	# wait for possible background nntplist
	if $test -n "$cmdlist"; then
	    wait
	    cmdlist=''
	fi

	# warn about long lines, malformed headers, misspelled newsgroups
	($artcheck $tmpart 79 /dev/null /dev/null) 2>/dev/null
	state=pgptest
	;;

(I learned so much about shell scripting when I first studied Rnmail /
Pnews.)

>> 3. Anywhere trn does string length checks (subject and from in newsgroup
>>    listings, headers and body lines in posts, warnings about lines too
>>    long when posting), those checks are not UTF-8 aware.
> 
> That's to be expected, but I'd hope I'm not coming anywhere close to the
> 998 character ceiling in which that would be an issue.

It's a lot of cosmetic problems. Columns don't line up, lines wrap too
soon, lines "over" 80 characters in post bodies trigger warnings.

> Here's something I don't know:
> 
> If I were complying with the standard, checking Subject for line length
> as an example, is it against the encoded non-ASCII characters, or after
> decoding? Now, that would make a substantial difference in the count.

The 998 line length rule applies to the encoding as used in NNTP. If you
use wrapped lines in headers:

	Subject: This subject line spans two lines because it
		is so very long

Then each line gets counted separately. If using MIME-encoded words to
put highbit characters in headers, you count the encoded length.
(RFC-2047 defines MIME-encoded words.) If your header, when unfolded,
is longer than 998 octets, I don't know what the overview functionality
does, but I'm guessing truncation. The newsreader will probably just
not unfold more than it needs to.

>>> Kids today are spoiled with newsreaders that do everything.
>> That's why I read mail with mailx, too.
> Hehehehehe

I also use nail, which understands IMAP, to read mail from my phone.

https://github.com/Eli-the-Bearded/heirloom-mailx

My modifications to that are more minor, mostly just getting it to
nicely coexist with my mailrc command changes. (I also only use a
special, more throwaway, domain for phone email reading, because I
don't like to store passwords on my phone.)

Elijah
------
composes MIME multipart messages by hand when needed
Technical Details
Message-ID: <eli$2008051347@qaz.wtf>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <rganif$m4h$1@neodome.net> <rgcudk$j76$1@dont-email.me> <eli$2008051309@qaz.wtf> <rgeqfo$6qp$2@dont-email.me>

Show Full Headers
Complete Article Headers
Message-ID: <eli$2008051347@qaz.wtf>
Subject: Re: trn 4 and UTF-8 (was: Is there a way to respond to an expired article if you know the message ID?)
Date: Wed, 05 Aug 2020 18:05:47 +0000
From: Eli the Bearded <*@eli.users.panix.com>
References: <rganif$m4h$1@neodome.net> <rgcudk$j76$1@dont-email.me> <eli$2008051309@qaz.wtf> <rgeqfo$6qp$2@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.readers
Organization: Some absurd concept
Lines: 114
Nntp-Posting-Host: panix5.panix.com
X-Trace: reader1.panix.com 1596650747 4907 166.84.1.5 (5 Aug 2020 18:05:47 GMT)
X-Complaints-To: abuse@panix.com
Nntp-Posting-Date: Wed, 5 Aug 2020 18:05:47 +0000 (UTC)
X-Liz: It's actually happened, the entire Internet is a massive game of Redcode
X-Motto: "Erosion of rights never seems to reverse itself." -- kenny@panix
X-Us-Congress: Moronic Fucks.
X-Attribution: EtB
Xfrom: is a real address
Encrypted: double rot-13
User-Agent: Vectrex rn 2.1 (beta)