Article View: news.software.readers
Article #262594UTF-8 "fix" for trn4-77
From: Eli the Bearded
Date: Fri, 02 Mar 2018 01:53
Date: Fri, 02 Mar 2018 01:53
41 lines
2850 bytes
2850 bytes
I've got a utf-8 clean display environment, but reading news in trn with
utf-8 characters in them would sometimes show mangled characters. I
guessed that trn was trampling the high-bit on iso-8859-1 high-bit
control characters (0x80 to 0x9F) and did nothing for a long time.
Then I noticed that there is a switch:
-j forces trn to leave control characters unmolested in
messages.
And testing that, I found that it worked to stop the utf-8 breakage.
Of course, it leaves control characters "unmolested" which is not
necessarily ideal.
This one line change, however, will "properly" defang control characters
(0x01 -> "^A", etc) while not brutalizing the high-bit stuff used by
UTF-8:
--- trn-4.0-test77/art.c.orig 2010-09-02 02:12:26.000000000 -0400
+++ trn-4.0-test77/art.c 2018-03-01 20:15:59.000000000 -0500
@ -468,7 +468,7 @@
outpos += 2;
}
else { /* other control char */
- if (dont_filter_control) {
+ if (dont_filter_control || (*bufptr & 0x80)) {
if (outputok)
putchar(*bufptr);
outpos++;
As should be clear, this does absolutely no good for you if your
environment is not utf-8 clean or if you are reading posts that are not
in utf-8.
What a tangled mess it is in artio.c (reading the article in) / art.c
(displaying the article to the user). I would not envy someone trying to
put a real character set conversion in.
Elijah
------
not sure if there is still a working trn mailing list
Technical Details
Message-ID:
<eli$1803012051@qz.little-neck.ny.us>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <eli$1803012051@qz.little-neck.ny.us> Subject: UTF-8 "fix" for trn4-77 Date: Fri, 02 Mar 2018 01:53:05 +0000 From: Eli the Bearded <*@eli.users.panix.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.(126883).mbox.7z!not-for-mail Newsgroups: news.software.readers Organization: Some absurd concept Lines: 41 NNTP-Posting-Host: panix5.panix.com X-Trace: reader1.panix.com 1519955585 18587 166.84.1.5 (2 Mar 2018 01:53:05 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Fri, 2 Mar 2018 01:53:05 +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) X-Comments: "'Pray that I don't alter the bargain further.' Welcome Darth Google." -- HonorableSoul X-Received-Bytes: 2684 X-Received-Body-CRC: 120600309