๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #264885

Re: Dialog signature delimiter

#264885
From: Bernd Rose
Date: Thu, 22 Apr 2021 18:50
68 lines
5086 bytes
On Wed, 21st Apr 2021 23:30:57 +0200, bill wrote:

[Multisource Copy&Paste: Snipped process description, correct assumptions]
> Since you said the OnBeforeSending script fires up /after/ the message is 
> already encoded, I was just hoping the OnBeforeSending script could convert
> the now unicode curly quotes to straight quotes in unicode.

At the time when OnBeforeSending fires up, the text will be encoded in about
any imaginable charset, but /not/ in 16-bit Unicode. 

As you type (or Copy&Paste), 40tude Dialog continuously analyzes the text
buffer. It checks, which characters are contained in the text buffer and
compares them against the list of permitted charsets:
Settings -> General_Settings -> Charsets -> Use_best_matching_charset_out_of

It internally reduces the list of charsets to those, that have the /least/
number of (different) characters contained in the text buffer, which can not
be encoded. As long, as you leave Unicode-encoding charsets like UTF-7 and
UTF-8 in this list, the number of un-encodable characters should be zero. 
From the remaining list of charsets, it picks the first.

When you watch the "Status" field in the upper area of the Compose Editor
window, you see the charset adjusting to the text you type. Until now, 
my current message shows "us-ascii", because it contains no special chars,
at all. When I type the German umlaut รค, though, the charset listed in the
Status field immediately changes to "iso-8859-1" (aka Latin-1), which is 
the first completely fitting charset in /my/ charset list. In your case,
a different charset might have been selected. If I insert curly quotation
marks (โ€žโ€ฆโ€œ), the charset listed in Status changes again. (Now to UTF-8 in
my case.)

OnBeforeSending would have encountered "us-ascii" formatted text, when I
would have sent only the first couple of lines, "iso-8859-1" later on, and
finally UTF-8.

If the script contained a replacement rule from รค to ae, that is consistent
to "iso-8859-1", it would say: Replace byte code 0xE4 with ae. Consistent
to UTF-8, OTOH, it needs to replace the 2-byte code 0xC3 0xA4.

To avoid creating garbage by the replacements, OnBeforeSending would need
to detect the current charset /and/ have replacement rules for every charset
not explicitly disabled. Moreover, the script code would need to detect and 
spare all header lines and any encoded attachment of the message.

One solution for the charset detection problem would be, to disable all
but one charset (from the list of permitted charsets). If you ensure, that
you always type plain characters from the range of the lower 7-bit ASCII
characters, this would be fine. But extremely unlikely. Therefore, the
fixed charset would need to be ready for virtually any character. This
just leaves UTF-7 and UTF-8. (Both have their own problems when used in
40tude Dialog with very high Unicode character planes. - But that's a 
different story and solvable with a set of specific scripts.)

But if you set UTF-7 or UTF-8 as your only permitted charset, you post
most of your messages with unnecessary overhead. This is - historically -
massively frowned upon and will get you loads of "friendly suggestions"
to configure your Newsreader in a more appropriate way.

Apart from such hints, you'd still need to set up all those replacement
rules. To make things worse, both UTF-7 and UTF-8 are variable wide
character encoding schemes. Your replacement rules would not only need
to replace sometimes one, sometimes more bytes for a single character.
The replacement function would need to evaluate the whole text stream
to not mix up multi-byte position start points.

I strongly suggest to leave this idea be...
 
Bernd
Technical Details
Message-ID: <1dcrggb5j969v$.dlg@b.rose.tmpbox.news.arcor.de>
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: <s5ilpb$kd9$1@gioia.aioe.org> <s5ir5o$7qt$1@tncsrv09.home.tnetconsulting.net> <s5irtv$ene$1@gioia.aioe.org> <s5iu6t$84h$1@tncsrv09.home.tnetconsulting.net> <w1ab8v93kvce$.dlg@b.rose.tmpbox.news.arcor.de> <s5jvec$5s7$1@gioia.aioe.org> <17rf3wjx02quj$.dlg@b.rose.tmpbox.news.arcor.de> <s5klfl$1ue5$1@gioia.aioe.org> <gr2vcjkxmucj.dlg@b.rose.tmpbox.news.arcor.de> <s5nsda$1lat$1@gioia.aioe.org> <1bdu7zohmx63b$.dlg@b.rose.tmpbox.news.arcor.de> <s5q5i8$mc2$1@gioia.aioe.org>

Show Full Headers
Complete Article Headers
Message-ID: <1dcrggb5j969v$.dlg@b.rose.tmpbox.news.arcor.de>
Subject: Re: Dialog signature delimiter
Date: Thu, 22 Apr 2021 20:50:23 +0200
From: Bernd Rose <b.rose.tmpbox@arcor.de>
References: <s5ilpb$kd9$1@gioia.aioe.org> <s5ir5o$7qt$1@tncsrv09.home.tnetconsulting.net> <s5irtv$ene$1@gioia.aioe.org> <s5iu6t$84h$1@tncsrv09.home.tnetconsulting.net> <w1ab8v93kvce$.dlg@b.rose.tmpbox.news.arcor.de> <s5jvec$5s7$1@gioia.aioe.org> <17rf3wjx02quj$.dlg@b.rose.tmpbox.news.arcor.de> <s5klfl$1ue5$1@gioia.aioe.org> <gr2vcjkxmucj.dlg@b.rose.tmpbox.news.arcor.de> <s5nsda$1lat$1@gioia.aioe.org> <1bdu7zohmx63b$.dlg@b.rose.tmpbox.news.arcor.de> <s5q5i8$mc2$1@gioia.aioe.org>
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
Cancel-Lock: sha1:KgbTC0BZR/SYj2enSoDXYGwalGg=
Injection-Info: solani.org; logging-data="6832"; mail-complaints-to="abuse@news.solani.org"
Newsgroups: news.software.readers
User-Agent: 40tude_Dialog/2.0.15.41 (6ddb0c0c.108.456)
Content-Transfer-Encoding: 8bit
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"
X-User-Id: eJwNysEBwCAIA8CVBAyScQRh/xHaex/Mxetsh28MJqx17VbfXJx+rDZDsYGgUfie9N/HihWcvJK0bPBePapJROcZvqpYFh/Drhn7