Article View: news.software.readers
Article #264636Re: [40tude] Edit -> Find regular expression?
From: Bernd Rose
Date: Sat, 23 Jan 2021 08:52
Date: Sat, 23 Jan 2021 08:52
58 lines
3810 bytes
3810 bytes
On Fri, 22nd Jan 2021 12:20:16 +0530, mike wrote: Hm. Where to start? In your message Message-ID: <rud3db$ggn$1@solani.org> you used a function name that differs from the program name. (Maybe a copy/paste error?) But this way, the main function will never be called. Using OnBeforeSavingMessage will /not/ accomplish, what you have in mind, because it only fires when saving /incoming/ message to the Dialog database. It does /not/ work when saving drafts. (Drafts are saved from editor window as you type and are neither checked nor altered when saving them without sending.) You get compile error for the (seemingly identical) OnBeforeSavingMessage script (compared to OnBeforeSendingMessage), because the latter program is written to be able to be canceled, while the latter is not. Instead of using a main function with return value as in OnBeforeSendingMessage, you need to use a main /procedure/ with OnBeforeSendingMessage: procedure OnBeforeSavingMessage(var Message: TStringlist; Servername:string; IsEmail: boolean); And this procedure must /not/ have a line like: result:=true; The number 2147483647 is the maximum string length for the copy function. It prevents buffer overflow. Larger strings will be truncated. Back to your original question: What has to be replaced depends on the encoding of your message. The replacement occurs right before sending. Therefore it is done on the raw outgoing message (including all headers!!). To replace the German umlaut "รค" in several encodings, you'd need to adjust the search/replace strings with sth. like: s:=stringreplace(s,'รค','ae'); s:=stringreplace(s,'=E4','ae'); s:=StringReplace(s,'=C3=A4','ae'); Be aware, that this kind of alteration on the raw message must only be used for characters or strings, which may /not/ be found inside the header texts!! Else, anything can happen: From posting invalid messages to stray messages reaching the wrong recipient! On another thought: Maybe you can use the LastMessageCheck script to see, how the characters are encoded in your outgoing messages. This script opens a preview of the raw message right before sending (if it included correctly). In a case of error, you can cancel the sending process. Be aware, though, that everything written in this message will be lost on cancel. So you need to start typing from scratch. (Or keep the whole message in clipboard right before sending.) The (German) download site for the LastMessageCheck script is: http://4d.vollmeier.at/scripte/ereignisscripte/onbeforesendingmessage/lastmessagecheck.html Hopefully, I have addressed all matters... Bernd
Technical Details
Message-ID:
<13ti6j8mwqal2.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-mailReferences:
<ru5nfg$si7$1@solani.org> <3xo0b6k69bco$.dlg@v.nguard.lh> <ruagkd$j08$1@solani.org> <1gf2aqovcfhb8.dlg@v.nguard.lh> <rubuok$j1b$1@solani.org> <rubvif$jli$1@solani.org> <1pop06goudbzf$.dlg@b.rose.tmpbox.news.arcor.de> <rud043$e9r$1@solani.org> <rudsj7$vme$1@solani.org>Show Full Headers
Complete Article Headers
Message-ID: <13ti6j8mwqal2.dlg@b.rose.tmpbox.news.arcor.de> Subject: Re: [40tude] Edit -> Find regular expression? Date: Sat, 23 Jan 2021 09:52:02 +0100 From: Bernd Rose <b.rose.tmpbox@arcor.de> References: <ru5nfg$si7$1@solani.org> <3xo0b6k69bco$.dlg@v.nguard.lh> <ruagkd$j08$1@solani.org> <1gf2aqovcfhb8.dlg@v.nguard.lh> <rubuok$j1b$1@solani.org> <rubvif$jli$1@solani.org> <1pop06goudbzf$.dlg@b.rose.tmpbox.news.arcor.de> <rud043$e9r$1@solani.org> <rudsj7$vme$1@solani.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 User-Agent: 40tude_Dialog/2.0.15.41 (6c604cfa.179.363) Content-Transfer-Encoding: 8bit Newsgroups: news.software.readers Cancel-Lock: sha1:F7DCpx7/dYbKZI9LkBxpbm0LFXY= Content-Type: text/plain; charset="iso-8859-1" Mime-Version: 1.0 Injection-Info: solani.org; logging-data="5745"; mail-complaints-to="abuse@news.solani.org" X-User-Id: eJwNxosNACAIA9GVLEgt4/hj/xE0l5dcOME9OoM9KkrqqxrN7IP2VAd2VsYp419Lnw6G3bbGGRfz1wDH0E0duzIhtRat0R+FzxgF